Jump to content

Seeders/Leechers and Bitfield


dimpim

Recommended Posts

Posted

Hi everybody,

I'm developing a BitTorrent-like client, but I'm pretty much a novice in the field. How do I find out if a peer I'm connected to is a seeder or a leecher? I was thinking about evaluating the download/upload ratio, but somebody suggested me that it is a better idea if I check the peer's bitfield (if the peer is a seeder then the bitfield should be all equal to 1).

Is that right? If yes, how do I do that?

Thanks in advance, and sorry for the stupid question.

Posted

There is no way to know for sure of course, they could send any data they wanted to.. and some clients do just that. This is "teh intarwebs" and lying is part of the game, you can't expect other clients to be "nice" or even standard compliant, many leechers clients will even lie about what client they are - if you do they will just take advantage of it and you lose.

You could check their bitfield, but they could send any value of the correct size and with the padding bits reset (since you must disconnect otherwise) and you'd have a hard time finding out about it. Check whether they send have messages perhaps, but a seed could pretend to be a leecher and send random Have's and/or requests (why? well who knows, fact is that they could). You could also check whether they're ever interested in your pieces which doesn't mean much, but if they Never are (or reject/cancel when you send them) then that adds to the suspicion that it's a seed.

So the ends up being fuzzy logic - adding all those factors (and more?) together should give a "pretty accurate" result.

But seeds pretend to be peers for several purposes (avoid bitfield-based blocking from the ISP, "super seeding", to annoy devs of other clients..) you might detect super seeders by the fact that they don't want and/or accept your pieces even if they don't (claim to) have them (whether you can try to force-feed them depends on whether you agreed to use the Fast Extension), and they will magically get pieces (but that Alone is no reason to identify it as super seeder). Unless they become smart and go to greater lengths to look like a normal peer.

And peers may try to pretend to be seeds for whatever reason they think is good (maybe because some clients connect to As Many As Possible seeds but limit the number of leechers), it won't help them too much though since a single piece request would give them away (seeds never have a good reason to do this unless super seeds Really want to avoid being flagged as such).

As I said, it's fuzzy logic..

And you could add client version checks such as: BitVomit is never a seed :)

Archived

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

×
×
  • Create New...