mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 09:31:20 +00:00
swarm: Extend NetworkBehaviour callbacks. (#2011)
Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -147,17 +147,17 @@ pub trait NetworkBehaviour: Send + 'static {
|
||||
fn inject_dial_failure(&mut self, _peer_id: &PeerId) {
|
||||
}
|
||||
|
||||
/// Indicates to the behaviour that a new listener was created.
|
||||
fn inject_new_listener(&mut self, _id: ListenerId) {
|
||||
}
|
||||
|
||||
/// Indicates to the behaviour that we have started listening on a new multiaddr.
|
||||
fn inject_new_listen_addr(&mut self, _addr: &Multiaddr) {
|
||||
fn inject_new_listen_addr(&mut self, _id: ListenerId, _addr: &Multiaddr) {
|
||||
}
|
||||
|
||||
/// Indicates to the behaviour that a new multiaddr we were listening on has expired,
|
||||
/// Indicates to the behaviour that a multiaddr we were listening on has expired,
|
||||
/// which means that we are no longer listening in it.
|
||||
fn inject_expired_listen_addr(&mut self, _addr: &Multiaddr) {
|
||||
}
|
||||
|
||||
/// Indicates to the behaviour that we have discovered a new external address for us.
|
||||
fn inject_new_external_addr(&mut self, _addr: &Multiaddr) {
|
||||
fn inject_expired_listen_addr(&mut self, _id: ListenerId, _addr: &Multiaddr) {
|
||||
}
|
||||
|
||||
/// A listener experienced an error.
|
||||
@ -168,6 +168,14 @@ pub trait NetworkBehaviour: Send + 'static {
|
||||
fn inject_listener_closed(&mut self, _id: ListenerId, _reason: Result<(), &std::io::Error>) {
|
||||
}
|
||||
|
||||
/// Indicates to the behaviour that we have discovered a new external address for us.
|
||||
fn inject_new_external_addr(&mut self, _addr: &Multiaddr) {
|
||||
}
|
||||
|
||||
/// Indicates to the behaviour that an external address was removed.
|
||||
fn inject_expired_external_addr(&mut self, _addr: &Multiaddr) {
|
||||
}
|
||||
|
||||
/// Polls for things that swarm should do.
|
||||
///
|
||||
/// This API mimics the API of the `Stream` trait. The method may register the current task in
|
||||
|
Reference in New Issue
Block a user