Jump to content

bittorrent extensions: metadata and smart ban


Recommended Posts

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

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

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

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 block

So I guess I need to:

1. see if the PIECE passes/fails the hash check

2. if the piece fails the hash check, then I need to calculate the CRC of every BLOCK that forms the piece

Did I get it right?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...