[bittorrent] "removed" peers in PEX

Josef Drexler josef at ttdpatch.net
Thu May 28 14:55:05 EDT 2009


On May 27, 2009, at 3:37 PM, BeCe wrote:
> [...] I believe I already understand how PEX
> works, but what I don't know is how is the content of "removed" peers
> list created. I mean, how peer knows that he should remove specific  
> peer
> from list, and more important why this is relevant to receiver of such
> list? How should he react after getting removed peers list?

I don't think this is documented anywhere, but looking at the values  
sent by various clients and the source code of one of the  
implementations, it appears that the "removed" list contains the  
clients that the peer who is sending this message has removed from  
its peer list.

In other words, the "added" list reports peers added to its list, and  
the "removed" list reports peers removed from its list, both sending  
only the differences since the last message. This allows one to  
reconstruct exactly what another peer's peer list looks like. I do  
not however know how this could be useful in practice. Maybe it's  
supposed to cut down on failed connections to peers which have  
dropped out of the cloud.

In my implementation for rtorrent I send the "removed" list as  
described above, but discard it in replies from others. At the very  
least, if you do use it to remove peers from your own list, you  
should probably check that they were actually also present in an  
"added" message from this peer, to avoid malicious peers making you  
drop peers that you should really keep. It should also be useful to  
keep track of how many other peers still have it in the list, for the  
same reason.

-- 
Josef Drexler
josef at ttdpatch.net




More information about the BitTorrent mailing list