[−][src]Trait ckb_network::CKBProtocolContext
Abstract protocol context
Required methods
pub fn set_notify(&self, interval: Duration, token: u64) -> Result<(), Error>
[src]
Set notify to tentacle
pub fn remove_notify(&self, token: u64) -> Result<(), Error>
[src]
Remove notify
pub fn quick_send_message(
&self,
proto_id: ProtocolId,
peer_index: PeerIndex,
data: Bytes
) -> Result<(), Error>
[src]
&self,
proto_id: ProtocolId,
peer_index: PeerIndex,
data: Bytes
) -> Result<(), Error>
Send message through quick queue
pub fn quick_send_message_to(
&self,
peer_index: PeerIndex,
data: Bytes
) -> Result<(), Error>
[src]
&self,
peer_index: PeerIndex,
data: Bytes
) -> Result<(), Error>
Send message through quick queue
pub fn quick_filter_broadcast(
&self,
target: TargetSession,
data: Bytes
) -> Result<(), Error>
[src]
&self,
target: TargetSession,
data: Bytes
) -> Result<(), Error>
Filter broadcast message through quick queue
pub fn future_task(
&self,
task: Pin<Box<dyn Future<Output = ()> + Send + 'static>>,
blocking: bool
) -> Result<(), Error>
[src]
&self,
task: Pin<Box<dyn Future<Output = ()> + Send + 'static>>,
blocking: bool
) -> Result<(), Error>
spawn a future task, if blocking
is true we use tokio_threadpool::blocking to handle the task.
pub fn send_message(
&self,
proto_id: ProtocolId,
peer_index: PeerIndex,
data: Bytes
) -> Result<(), Error>
[src]
&self,
proto_id: ProtocolId,
peer_index: PeerIndex,
data: Bytes
) -> Result<(), Error>
Send message
pub fn send_message_to(
&self,
peer_index: PeerIndex,
data: Bytes
) -> Result<(), Error>
[src]
&self,
peer_index: PeerIndex,
data: Bytes
) -> Result<(), Error>
Send message
pub fn filter_broadcast(
&self,
target: TargetSession,
data: Bytes
) -> Result<(), Error>
[src]
&self,
target: TargetSession,
data: Bytes
) -> Result<(), Error>
Filter broadcast message
pub fn disconnect(
&self,
peer_index: PeerIndex,
message: &str
) -> Result<(), Error>
[src]
&self,
peer_index: PeerIndex,
message: &str
) -> Result<(), Error>
Disconnect session
pub fn get_peer(&self, peer_index: PeerIndex) -> Option<Peer>
[src]
Get peer info
pub fn with_peer_mut(
&self,
peer_index: PeerIndex,
f: Box<dyn FnOnce(&mut Peer)>
)
[src]
&self,
peer_index: PeerIndex,
f: Box<dyn FnOnce(&mut Peer)>
)
Modify peer info
pub fn connected_peers(&self) -> Vec<PeerIndex>
[src]
Get all session id
pub fn report_peer(&self, peer_index: PeerIndex, behaviour: Behaviour)
[src]
Report peer behavior
pub fn ban_peer(
&self,
peer_index: PeerIndex,
duration: Duration,
reason: String
)
[src]
&self,
peer_index: PeerIndex,
duration: Duration,
reason: String
)
Ban peer
pub fn send_paused(&self) -> bool
[src]
Can send message again?
pub fn protocol_id(&self) -> ProtocolId
[src]
current protocol id
Provided methods
pub fn p2p_control(&self) -> Option<&ServiceControl>
[src]
Raw tentacle controller