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) -> BoxFut<'_, K2Result<Bytes>>
pub fn peer_connect(&self, peer: Url) -> BoxFut<'_, 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.
Sourcepub fn recv_data(&self, peer: Url, data: Bytes) -> BoxFut<'_, K2Result<()>>
pub fn recv_data(&self, peer: Url, data: Bytes) -> BoxFut<'_, K2Result<()>>
Call this whenever data is received on an open connection.
Sourcepub fn set_unresponsive(
&self,
peer: Url,
when: Timestamp,
) -> BoxFut<'_, K2Result<()>>
pub fn set_unresponsive( &self, peer: Url, when: Timestamp, ) -> BoxFut<'_, K2Result<()>>
Call this whenever a connection to a peer fails to get established, sending a message to a peer fails or when we get a disconnected event from a peer.
Sourcepub fn check_message_permitted(
&self,
peer_url: &Url,
space_id: &Option<Bytes>,
module_id: &Option<String>,
message_type: &K2WireType,
) -> K2Result<bool>
pub fn check_message_permitted( &self, peer_url: &Url, space_id: &Option<Bytes>, module_id: &Option<String>, message_type: &K2WireType, ) -> K2Result<bool>
Check whether a message is permitted for a given peer and space
If all agents associated with the given peer and space id are blocked and the message is not of one of the explicitly allowed message types, this function will return false and increase the count of blocked messages by one.