-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request-Response: Add method connected_peers #2354
Conversation
I am undecided on this one. On the one hand, yes, it is just a small getter method. On the other hand:
Good catch. I am not aware of any cases, where this would not be desired behaviour. Thanks for adding it. |
Isn't this already the case right now because we have
In regard to AutoNAT you are probably right, yes. But in general this implies that the user implements the behaviour manually. In case of I don't really have a strong opinion on this. For AutoNAT I agree with you that eventually we have to track the connected peers separately anyway. And e.g. |
Fair point!
Do I understand correctly that this mechanism would not only be useful for a
My preference is still to include bd6622a only. Others might have an opinion as well though. |
Good point, yes I agree. |
For the record |
The request-response protocol manages a list of connected peers. This list is currently not exposed to the user, only the method
RequestResponse::is_connected
allows to the check the connection for a specific peers.However, in case that the user needs to know the whole list of connected peers, it forces them to also track connected peers themself, which is redundant as the information is already there, e.g. as it currently has to be done in the AutoNAT draft #2262.
56f1ede adds a method
RequestResponse::connected_peers
to share the list of connected peers.Apart from that, I noticed that at the moment
inject_address_change
is not handled, which means that the associatedConnection
still has the address of the oldConnectedPoint.
bd6622a changes this, unless there was a specific reason to do so?Note that with this change, if the ConnectedPoint changed from
Dialer
toListener
, the address will change fromSome(old_addr)
toNone
. Are there cases in which we still want to keep the old address? If I am not mistaken, the address is only used to return it inaddresses_of_peer
, therefore I would say it's valid to remove an outdated address?