[BitTorrent] Really random?

jamuraa at base0.net jamuraa at base0.net
Wed Jul 14 17:24:08 EDT 2004


On Wed, Jul 14, 2004 at 04:13:07PM -0400, John Prevost wrote:
> On Wed, 14 Jul 2004 21:56:46 +0200, Arvid Norberg <c99ang at cs.umu.se> wrote:
> > > Are you sure?. I thought BT client used the "sparse file" concept.
> > 
> > yes.
> > 
> > This is, roughly, the algorithm I employ in libtorrent, I'm pretty sure
> > it's the same for all clients supporting this kind of storage.
> 
> *blink*
> 
> Well, I can tell you for a fact that neither the standard Python
> client nor Azureus do it that way.  They just make use of sparse
> files--they seek to the position of the received data and write it
> out.  The OS decides whether or not the file is fully allocated to
> that size or if only the blocks needed for the data actually written
> are used.  (Both Unices and Windows 2k do support sparse files, not
> sure about other OSs.)

Actually, the standard Python client does do it this way since 3.3
(and approximately 07/07/2003, I think).  It used to do background
allocation, but mainline has used the "allocate a piece at a time and 
juggle pieces" way that is described here for a while.

> The system you describe sounds... rather hairy, really.  When you scan
> a file to see what has been received so far, do you scan each piece
> and see if its hash is in the list to recall which piece it is?  Or do
> you write the information about which pieces reside where to a file
> somewhere?  How do you handle multi-file torrents?

When you resume, an assumption is made that SHA1 hashes of pieces are 
unique in the file - this assumption is generally true, or at least
I was convinced when I was like "ehh, that can't be right" when it
happened.  In memory you maintain a slot -> piece correlation. 

-- 
Michael Janssen --- Jamuraa --- jamuraa at base0.net --- janssen at debian.org


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/BitTorrent/

<*> To unsubscribe from this group, send an email to:
    BitTorrent-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the BitTorrent mailing list