Trait ckb_network::CKBProtocolHandler [−][src]
pub trait CKBProtocolHandler: Sync + Send { fn init(&mut self, nc: Arc<dyn CKBProtocolContext + Sync>); fn connected(
&mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
_peer_index: PeerIndex,
_version: &str
) { ... } fn disconnected(
&mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
_peer_index: PeerIndex
) { ... } fn received(
&mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
_peer_index: PeerIndex,
_data: Bytes
) { ... } fn notify(&mut self, _nc: Arc<dyn CKBProtocolContext + Sync>, _token: u64) { ... } fn poll(
&mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>
) -> Poll<Option<()>> { ... } }
Expand description
Abstract protocol handle base on tentacle service handle
Required methods
fn init(&mut self, nc: Arc<dyn CKBProtocolContext + Sync>)
fn init(&mut self, nc: Arc<dyn CKBProtocolContext + Sync>)
Init action on service run
Provided methods
Called when opening protocol
fn disconnected(
&mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
_peer_index: PeerIndex
)
fn disconnected(
&mut self,
_nc: Arc<dyn CKBProtocolContext + Sync>,
_peer_index: PeerIndex
)
Called when closing protocol
Called when the corresponding protocol message is received
Called when the Service receives the notify task