dimpim Posted July 30, 2009 Report Share Posted July 30, 2009 Hi everybody, I'm writing a bittorrent client in java and right now I'm trying to implement some common extensions. I've read the libtorrent library source code, but I can't understand c/c++ very well, so here's the question: can somebody explain to me (even briefly) how the extensions "metadata transfer" and "smart ban" work? I have a vague idea about how they work, but I need to be sure about it. If you have a document or a link to a page that answers my question, that would be great, too.Thanks to everyone in advance, and sorry for my bad English! Link to comment Share on other sites More sharing options...
Switeck Posted July 30, 2009 Report Share Posted July 30, 2009 Smart ban is probably related to automatic banning of peer/seed ips that sent bad torrent data.Since more than 1 peer/seed may be responsible for a single piece of the torrent, sorting out which is good and which is bad can be hard...banning them all is foolish. Not banning the bad ones can likewise be foolish.So typically only those peers/seeds which have never successfully sent good data (after 1-5 tries) are banned. Or those which have sent a high degree of bad relative to good...get banned. Link to comment Share on other sites More sharing options...
dimpim Posted July 30, 2009 Author Report Share Posted July 30, 2009 Thank you very much for your answer. I still have some doubts, though.For example, you said that peers who send a high degree of bad data relative to good data get banned, but what's the value of "high" that optimizes the algorithm?Moreover, by reading the libTorrent source code, I understand that every time a block I receive from a peer fails the hash check, I need to calculate the block's CRC (using the Adler32 algorithm, for instance) and store it somewhere, because I will need it for future checks on the same block. Is that correct? Link to comment Share on other sites More sharing options...
DreadWingKnight Posted July 30, 2009 Report Share Posted July 30, 2009 You calculate the PIECE's SHA1 hash based on the defined hash in the .torrent.http://wiki.theory.org/BitTorrentSpecification Link to comment Share on other sites More sharing options...
dimpim Posted July 30, 2009 Author Report Share Posted July 30, 2009 That's right, but I think that's for the first part of the smart ban process, that is, the part in which I check the piece's hash.As I said, I'm not that good at reading C (in fact, I barely know it), but this is an excerpt from the smart_ban.cpp of the libTorrent source code:void on_piece_failed(int p){ // The piece failed the hash check. Record // the CRC and origin peer of every blockSo I guess I need to:1. see if the PIECE passes/fails the hash check2. if the piece fails the hash check, then I need to calculate the CRC of every BLOCK that forms the pieceDid I get it right? Link to comment Share on other sites More sharing options...
DreadWingKnight Posted July 30, 2009 Report Share Posted July 30, 2009 I'll be honest, uTorrent doesn't base its code on that library, so anything to do with that library should be asked of THEIR support group. Link to comment Share on other sites More sharing options...
dimpim Posted July 30, 2009 Author Report Share Posted July 30, 2009 I'm sorry, I thought the smart ban algorithm worked the same way in all the clients.Thank you anyway! Link to comment Share on other sites More sharing options...
DreadWingKnight Posted July 30, 2009 Report Share Posted July 30, 2009 It doesn't. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.