Hi Alan! I haven't experienced any more size-related crashes with the latest SVN code.
I have a few more questions/suggestions WRT the library, though. I'd like to show a list of peers and how fast each one is delivering/receiving data, and this seems to be impossible with the current code. It's keeping track of how fast it's interacting with each peer, but it's keeping that information to itself - in TorrentManager.connectedPeers[i].Peer.Connection.Monitor.UploadSpeed. What would a good way to expose this be? TorrentManager.DownloadSpeed() occasionally returns NaN. This means I need code like this to keep track of ETA: ETA = ((obj.downSpeed == 0) || double.IsNaN(obj.downSpeed)) ? TimeSpan.MaxValue : TimeSpan.FromSeconds((double)obj.bytesLeft / obj.downSpeed); It'd be more convenient to get back non-NaN values, and the fact that it's giving NaNs is an indication to me that something's up with the rate calculations. I can't get it to happen right now or I'd send a better bug report. There's no quick way to tell how many bytes have been downloaded in total (not just from this session) that I can tell of. I could use something like TorrentManager.PieceManager.BlocksDone (which would just have to call MyBitField.TrueCount and possibly subtract from MyBitField.Length), and multiply by the current piece size. I'd be willing to implement some of these changes, but I don't have a SVN account. If any of these questions are unclear, please let me know and I'll try to clarify. Will On 1/21/07, Alan McGovern <[EMAIL PROTECTED]> wrote: > Heya, > > I was away on holidays, so i only got the bug report now. > > I created a file which was over int.MaxValue bytes in length and used that > to test the monotorrent code. I came across a few places where i was getting > int overflows and commited fixes to SVN. Everything should be ok now > (fingers crossed ;) ). > > Let me know how you get on. > > Alan. > > > On 1/16/07, Will Murnane <[EMAIL PROTECTED]> wrote: > > > > I'm writing a BitTorrent client using the bitsharp library, and I > > encountered an error with a torrent that has total file size > 4GB. > > The problem occurs on line 124 of PieceMessage.cs: > > > > long pieceOffset = this.startOffset + this.PieceIndex * > > this.fileManager.PieceLength; > > > > this.PieceIndex and this.fileManager.PieceLength are both 32-bit ints; > > when they're multiplied an overflow can result, and pass an > > (overflowed) negative value to FileManager.Read. My suggestion is to > > cast one of them to long before the multiply is performed: > > > > long pieceOffset = this.startOffset + (long)this.PieceIndex * > > this.fileManager.PieceLength; > > > > That should fix the problem. Here's a screenshot of the debugger > > helping me find the problem: > > http://will.incorrige.us/torrent-error.png > > > > Last, thanks for the cool library! I was afraid I'd have to write my > > own bittorrent library to get this working, but bitsharp is working > > (mostly :-P) nicely. > > > > Thanks, > > Will > > _______________________________________________ > > Mono-list maillist - [email protected] > > http://lists.ximian.com/mailman/listinfo/mono-list > > > > _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
