Nixers project: Bittorrent library - Community & Forums Related Discussions
Users browsing this thread: 18 Guest(s)
|
|||
After talking a bit on ##bittorrent @freenode, I learned how clients seems to implement it:
Some put parts on multiple files in some way or another (like above). But most are putting the parts directly in the torrent file: 1 - Write parts at the beginning of the torrent file (the full data blob, not the .torrent metainfo file), and sort them as they come:
2 - Or they allocate storage for the file (such as an empty 2GB file) and fill it with the parts as they come, writing them with the correct offset. This way is much simpler: as you have a list of which part goes where, there is no sorting involved: read where should the part go, an you have where you should read it. With this latter approach, in the case of multifile torrents:
These two approaches (1- and 2-) has an advantage: no need to keep the parts files (which cost a lot of storage [EDIT] and inodes). On the other hand, if the final file is moved, it can not be seeded anymore. If I was me, I would still do one file per part, but you are no me. :) |
|||