Allow StreamMuxer to notify changes in the address (#1621)

* Allow StreamMuxer to notify changes in the address

* Fix doc link

* Revert accidental rename

* Other accidental rename

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
This commit is contained in:
Pierre Krieger
2020-06-30 17:10:53 +02:00
committed by GitHub
parent d5b26359bb
commit 826f5130cd
23 changed files with 330 additions and 57 deletions

View File

@ -496,6 +496,11 @@ where TBehaviour: NetworkBehaviour<ProtocolsHandler = THandler>,
let connection = connection.id();
this.behaviour.inject_event(peer, connection, event);
},
Poll::Ready(NetworkEvent::AddressChange { connection, new_endpoint, old_endpoint }) => {
let peer = connection.peer_id();
let connection = connection.id();
this.behaviour.inject_address_change(&peer, &connection, &old_endpoint, &new_endpoint);
},
Poll::Ready(NetworkEvent::ConnectionEstablished { connection, num_established }) => {
let peer_id = connection.peer_id().clone();
let endpoint = connection.endpoint().clone();