When a peer connects to another partner that has all the parts, how does the recognizing partner know that what it is connected to is actually a seed (and has all parts)? Are there messages sent between them?
In clients such as uTorrent, the expert seems to be aware of the download progress of each peer to which he has connected. How is all this known? Does a peer get that another peer is a seed if the progress is 100% or for this there are specific messages? What parts of the protocol deal with all this?
The peer knows if the other peer is a seed if the other peer is:
sends a fully completed bitfield, indicating that it has all the parts in the torrent. - BEP3
bitfield
sends incomplete bitfield, and then all messages havefor the remaining parts that he did not have from the very beginning. (It can either be that he constantly downloads and completes the torrent, or that he sends lazy bitfield.) - BEP3
have
lazy bitfield
sends a message have allaccording to Fast Extension - BEP6
have all
sends upload only=1in accordance with the Extension for partial seeds - BEP21Partial seed means that the peer has downloaded only parts of the torrent and no longer wants to download and visits what it has.
upload only=1
, have.
.
, bitfield, , . have , ( , , ).
Fast Extension, have all have none.
have none
Superseeding, , , . , , , , , .
. have x, , x, , x ( , ). , , , , Superseeding.
have x
x
:
The peer protocol refers to file fragments by index, as described in the metainfo file, starting from zero. When a peer finishes loading a piece and checks for hash matching, he announces that he has this piece for all of his peers.
Then, yes, messages are exchanged by peers so that they can know what is available for download. The "part" protocol that deals with this is the Peer protocol.