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

Wednesday, August 24, 2005

Progressing on BT data structures

As mentioned, it's critical to get the data structures integration right here, and thus I'm taking time to think things through properly. Also, I'd like to re-use as much of existing codebase as possible, for obvious reasons.

Right now, I have the basics up - wrappers for SharedFile and PartData, which basically mirror their children's state, and forward calls to proper children, all achieved via cpl of virtual functions. Additionally, I had to create a custom HashWork and override some functions there as well to get the hashing stuff working across files. Now, all this is only initial code (it compiles, but hasn't been tested), so bugs are still there, but seems we'r getting somewhere.

So far, changes to the core have mainly been moving some functions into protected from private and changed to virtuals; some operations were also moved to separate functions to allow overriding by derived classes (PartData::corruption, HashWork::getNext come to mind). Other than that, no changes have been neccesery to accomodate these custom data structures. Thus, from the looks of it, the design decisions made about a year ago seem to be holding up well.

The files, for your viewing pleasure:
hncore/bt/files.h
hncore/bt/files.cpp
hncore/bt/bget.cpp

The last of them is a small driver application, that I intend to turn into a wget-like command-line utility, with the difference that it'll just download torrents. The purpose is mainly simplifying the development of the module, but it can be released separately for unix platforms as a standalone tool later, if there's interest in that.

I'd like to get to initial networking stuff tomorrow already, but there are still some open ends at the data structures... on the other hand, I can fix them on the fly... we'll see.

Madcat, ZzZz



Comments:
In file files.cpp function TorrentFile::read():
Shouldn't
Iter i = m_children.upper_bound()
be
... = m_children.lower_bound()
?
And in case that (*i).second->getSize() > end for a processed file, then the function will either return an empty string (in case the first file is > end) or chop off some data (all other files > end). Or am I mistaken?

sca
 
Hmm, lower_bound() doesn't seem to be what I thought it was. I'm kinda unconcentrated atm, sorry for that.
 
Yes, you'r right, it should be lower_bound(), just as in the other two places in the file.

Madcat.
 
Post a Comment



<< Home

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