Alo Sarv
lead developer

Donate via
MoneyBookers

Latest Builds

version 0.3
tar.gz tar.bz2
Boost 1.33.1 Headers
MLDonkey Downloads Import Module Development
Payment completed
Development in progress.
Developer's Diary
irc.hydranode.com/#hydranode

Thursday, October 20, 2005

Back in action

The real-life problems that have been plagueing me for nearly two weeks finally reached a turning point yesterday; while not being completely resolved, I have a clear understanding on what's going on and what's the future. So today, I was able to focus on coding again, and with progress.

The first discovery today was three issues in ed2k clients-management code, which caused considerable performance problems for ed2k module; one was caused by ~50ms-variation in our event-engine, which resulted in udp reasks being stopped (with notice "reask time, but we already did that 1799 seconds ago"), and client becoming "zombie" (never asked again). The second issue was related to TCP reasks, where sometimes the connection fails before we manage to complete the handshake/request with the client. Now we keep track of current session state, and drop the source if something like that happens (to avoid it becoming yet another "zombie" client). The third issue was rather rare, namely when we were uploading to the client, and downloading at the same time, and the remote client stopped the transfer (to us) session, and sent us back to queue, and then sent AcceptUploadReq (to re-start downloading), we simply ignored it, since we "thought" we were already downloading (downloading state was only reset on connection-close).

Then I recalled that I had heard multiple reports over several months about ipfilter not working properly, and since ipfilter is based on RangeList API, I headed down to hnbase/tests/test-range.cpp to figure out what's going on. Creating the test-case was easy - rangelist with ranges 0...2M and 2M+1...4M; it exposed the bug, which was an integer overflow in Range::operator<, which was triggered for all ranges that exceeded range size maximum (4M in case of 32bit values). It never surfaced in PartData, since that uses 64bit ranges everywhere, but ipfilter used 32bit ranges, and made use of the complete number spectrum (up to 4M @ 255.255.255.255).

Next up I cleaned up the BT module classes, removed Manager and TorrentDb, merging the code into BitTorrent class, in an attempt to keep the module class design simple. Majority of additional time went to implementing initial support for resuming downloads after restarts, since that was never handled before; now most of the resuming code is finished, but PartialTorrent internally doesn't handle it flawlessly yet - it fails to recognize that some of the files in the torrent have already been completed.

Other miscellaneous changes include the addition of 'uptime' command to hnshell, and workaround for completing/moving files when the destination file-name already exists - now we prepend the filename with '_' if that happens.

Madcat, ZzZz



Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?