pub trait TxBaseHandler:
'static
+ Send
+ Sync
+ Debug {
// Provided methods
fn new_listening_address(&self, this_url: Url) -> BoxFut<'static, ()> { ... }
fn peer_connect(&self, peer: Url) -> K2Result<()> { ... }
fn peer_disconnect(&self, peer: Url, reason: Option<String>) { ... }
}Expand description
Base trait for transport handler events. The other three handler types are all based on this trait.
Provided Methods§
Sourcefn new_listening_address(&self, this_url: Url) -> BoxFut<'static, ()>
fn new_listening_address(&self, this_url: Url) -> BoxFut<'static, ()>
A notification that a new listening address has been bound. Peers should now go to this new address to reach this node.
Sourcefn peer_connect(&self, peer: Url) -> K2Result<()>
fn peer_connect(&self, peer: Url) -> K2Result<()>
A peer has connected to us. In addition to the preflight logic in TxHandler, this callback allows space and module logic to block connections to peers. Simply return an Err here.
Sourcefn peer_disconnect(&self, peer: Url, reason: Option<String>)
fn peer_disconnect(&self, peer: Url, reason: Option<String>)
A peer has disconnected from us. If they did so gracefully the reason will be is_some().