[][src]Trait ckb_network::CKBProtocolHandler

pub trait CKBProtocolHandler: Sync + Send {
    pub fn init(&mut self, nc: Arc<dyn CKBProtocolContext + Sync>);

    pub fn connected(
        &mut self,
        _nc: Arc<dyn CKBProtocolContext + Sync>,
        _peer_index: PeerIndex,
        _version: &str
    ) { ... }
pub fn disconnected(
        &mut self,
        _nc: Arc<dyn CKBProtocolContext + Sync>,
        _peer_index: PeerIndex
    ) { ... }
pub fn received(
        &mut self,
        _nc: Arc<dyn CKBProtocolContext + Sync>,
        _peer_index: PeerIndex,
        _data: Bytes
    ) { ... }
pub fn notify(
        &mut self,
        _nc: Arc<dyn CKBProtocolContext + Sync>,
        _token: u64
    ) { ... }
pub fn poll(
        &mut self,
        _nc: Arc<dyn CKBProtocolContext + Sync>
    ) -> Poll<Option<()>> { ... } }

Abstract protocol handle base on tentacle service handle

Required methods

pub fn init(&mut self, nc: Arc<dyn CKBProtocolContext + Sync>)[src]

Init action on service run

Loading content...

Provided methods

pub fn connected(
    &mut self,
    _nc: Arc<dyn CKBProtocolContext + Sync>,
    _peer_index: PeerIndex,
    _version: &str
)
[src]

Called when opening protocol

pub fn disconnected(
    &mut self,
    _nc: Arc<dyn CKBProtocolContext + Sync>,
    _peer_index: PeerIndex
)
[src]

Called when closing protocol

pub fn received(
    &mut self,
    _nc: Arc<dyn CKBProtocolContext + Sync>,
    _peer_index: PeerIndex,
    _data: Bytes
)
[src]

Called when the corresponding protocol message is received

pub fn notify(&mut self, _nc: Arc<dyn CKBProtocolContext + Sync>, _token: u64)[src]

Called when the Service receives the notify task

pub fn poll(
    &mut self,
    _nc: Arc<dyn CKBProtocolContext + Sync>
) -> Poll<Option<()>>
[src]

Behave like Stream::poll

Loading content...

Implementors

Loading content...