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

@@ -155,6 +155,16 @@ where
/// Event that was produced by the node.
event: TOutEvent,
},
/// An established connection has changed its address.
AddressChange {
/// The connection whose address has changed.
connection: EstablishedConnection<'a, TInEvent, TConnInfo, TPeerId>,
/// New endpoint of this connection.
new_endpoint: ConnectedPoint,
/// Old endpoint of this connection.
old_endpoint: ConnectedPoint,
},
}
impl<TTrans, TInEvent, TOutEvent, THandler, TConnInfo, TPeerId> fmt::Debug for
@@ -240,6 +250,13 @@ where
.field("event", event)
.finish()
}
NetworkEvent::AddressChange { connection, new_endpoint, old_endpoint } => {
f.debug_struct("AddressChange")
.field("connection", connection)
.field("new_endpoint", new_endpoint)
.field("old_endpoint", old_endpoint)
.finish()
}
}
}
}