Struct ethcore_light::net::LightProtocol [] [src]

pub struct LightProtocol { /* fields omitted */ }

This is an implementation of the light ethereum network protocol, abstracted over a Provider of data and a p2p network.

This is simply designed for request-response purposes. Higher level uses of the protocol, such as synchronization, will function as wrappers around this system.

Methods

impl LightProtocol
[src]

Create a new instance of the protocol manager.

Attempt to get peer status.

Make a request to a peer.

Fails on: nonexistent peer, network error, peer not server, insufficient buffer. Does not check capabilities before sending. On success, returns a request id which can later be coordinated with an event.

Make an announcement of new chain head and capabilities to all peers. The announcement is expected to be valid.

Add an event handler.

These are intended to be added when the protocol structure is initialized as a means of customizing its behavior, and dispatching requests immediately upon events.

Signal to handlers that network activity is being aborted and clear peer data.

Handle an LES packet using the given io context. Packet data is untrusted, which means that invalid data won't lead to issues.

called when a peer connects.

called when a peer disconnects.

Execute the given closure with a basic context derived from the I/O context.

Trait Implementations

impl NetworkProtocolHandler for LightProtocol
[src]

Initialize the handler

Called when new network packet received.

Called when new peer is connected. Only called when peer supports the same protocol.

Called when a previously connected peer disconnects.

Timer function called after a timeout created with NetworkContext::timeout.