Trait ethcore_light::net::IoContext [] [src]

pub trait IoContext {
    fn send(&self, peer: PeerId, packet_id: u8, packet_body: Vec<u8>);
    fn respond(&self, packet_id: u8, packet_body: Vec<u8>);
    fn disconnect_peer(&self, peer: PeerId);
    fn disable_peer(&self, peer: PeerId);
    fn protocol_version(&self, peer: PeerId) -> Option<u8>;
    fn persistent_peer_id(&self, peer: PeerId) -> Option<NodeId>;
}

An I/O context which allows sending and receiving packets as well as disconnecting peers. This is used as a generalization of the portions of a p2p network which the light protocol structure makes use of.

Required Methods

Send a packet to a specific peer.

Respond to a peer's message. Only works if this context is a byproduct of a packet handler.

Disconnect a peer.

Disable a peer -- this is a disconnect + a time-out.

Get a peer's protocol version.

Persistent peer id

Implementors