pub struct TxImpHnd { /* private fields */ }Expand description
This is the low-level backend transport handler designed to work with DefaultTransport. Construct using (TxImpHnd::new), with a high-level DynTxHandler, then call DefaultTransport::create to return the high-level handler from the TransportFactory.
Implementations§
Source§impl TxImpHnd
impl TxImpHnd
Sourcepub fn new(handler: DynTxHandler) -> Arc<Self>
pub fn new(handler: DynTxHandler) -> Arc<Self>
When constructing a Transport from a TransportFactory, you need a TxImpHnd for calling transport events. Pass the handler into here to construct one.
Sourcepub fn new_listening_address(&self, this_url: Url) -> BoxFut<'static, ()>
pub fn new_listening_address(&self, this_url: Url) -> BoxFut<'static, ()>
Call this when you receive or bind a new address at which this local node can be reached by peers
Sourcepub fn peer_connect(&self, peer: Url) -> K2Result<Bytes>
pub fn peer_connect(&self, peer: Url) -> K2Result<Bytes>
Call this when you establish an outgoing connection and when you establish an incoming connection. If this call returns an error, the connection should be closed immediately. On success, this function returns bytes that should be sent as a preflight message for additional connection validation. (The preflight data should be sent even if it is zero length).
Sourcepub fn peer_disconnect(&self, peer: Url, reason: Option<String>)
pub fn peer_disconnect(&self, peer: Url, reason: Option<String>)
Call this whenever a connection is closed.