Custom flag of peer
master255 opened this issue · comments
@arvidn I want to add a flag (extension) for a peer that the peer can be url-seeded.
I already have a Java Pipeline Web Server. It remains to change the logic of the library so that it will automatically add some peers to url-seeds, according to the flag in the response.
Where can I find free flags in the library and which one should I use? I only need a binary flag.
Okay. I found where to add my flag.
For the indication that the peer, can be url-seeded - I use the 17th bit.
libtorrent/src/bt_peer_connection.cpp
Line 704 in d102b9c
In the end I decided not to use it.
Instead, I added a new parameter up in handshake. u is urlseed, p is port.
int const port = m_settings.get_int(settings_pack::urlseed_port);
if (port != 0) handshake["up"] = port;
It's as flexible and efficient as possible, and I would add that to the release (libtorrent).
It's only about 20 lines of code that don't really affect anything, but allows to transfer data via https protocol.