Trait TxBaseHandler

Source
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§

Source

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.

Source

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.

Source

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().

Implementors§