Yesterday ... well, that wasn't a good day. Everyone knows one shouldn't drink and code. And everyone knows premature optimizations are the root of all evil. And also, everyone knows that programmers are the last persons to know about the bottlenecks in their apps. And yet still everyone ignores those simple rules. That's exactly what I did on the night before today as well - namely, the Scheduler optimizations, and the getTick() optimization. The getTick() one broke hnanalyze.pl script (and caused chemical to almost lose his entire statistics history); the Scheduler patch introduced a huge memory leak (~60mb leaked in 12 hrs), at least two segflt's and gave near-zero performance boost. In addition to that, the added FileRating support in searchresults was broken as well, the reality is that servers just send the tag right now, but no clients yet provide this data to servers, so the servers just send nulls right now. Sigh.
Recovering from that setback, and starting fresh today, here are the new accomplishments of tonight's coding session:
- Fixed DNS Resolver on win32 when interface names were too long (out-of-memory error).
- Fixed couple of bugs in error-handling code when temp files loading fails.
- Fixed downloading of files of size exactly N * 9500kb (ed2k chunksize).
- When re-hashing chunks after temp file modification change, rehash ALL chunks, not just completed ones, because additional data might have been added to the file while we were away, and only way to detect that is to re-hash everything. This should allow manual importing of (otherwise incompatible) temp files. No guarantees though.
- Discovered (and worked around) yet another Boost.Filesystem bug on win32 (even with native name-check, it broke on filenames with spaces in them for no apparent reason).
- Each SSocket is now accompanied by download and upload Speed-o-Meters.
- ModuleBase now exposes getUpSpeed and getDownSpeed signals, to which all their sockets are connected (by Scheduler), allowing viewing each modules' transfer rates separately. Additionally, ModuleBase now keeps SessionTransfered and TotalTransfered values (and stores them in prefs) for further statistics-viewing.
- 'lsmod' command in hnshell was updated to provide more interesting output, including per-module transfer rates and session/total transfered amounts.
- PartData now exposes getDownSpeed signal, to which modules should connect their socket's getSpeed method while download transfer is in progress.
- 'vd' command in hnshell now displays downloadrates for all downloads.
- Fixed a minor bug in Bittorrent Client message handling, where availability bitfield was attempted to be updated even when it didn't exist.
- Temp file space allocation is now performed in WorkThread. If allocation fails, the download is auto-paused until enough space becomes available. If a download has been auto-paused, re-tries to allocate disk space are done roughly every 10 minutes (standard temp files save interval), and if disk space becomes available, the download is resumed. Manual resuming also continues the download, but allocation will be attemted upon next buffer flush (either timed or due to additional data being downloaded).
Madcat, ZzZz