[][src]Module lightning::ln::peer_handler

Top level peer message handling and socket handling logic lives here.

Instead of actually servicing sockets ourselves we require that you implement the SocketDescriptor interface and use that to receive actions which you should perform on the socket, and call into PeerManager with bytes read from the socket. The PeerManager will then call into the provided message handlers (probably a ChannelManager and Router) with messages they should handle, and encoding/sending response messages.

Structs

MessageHandler

Provides references to trait impls which handle different types of messages.

PeerHandleError

Error for PeerManager errors. If you get one of these, you must disconnect the socket and generate no further read/write_events for the descriptor, only triggering a single disconnect_event (unless it was provided in response to a new_*_connection event, in which case no such disconnect_event must be generated and the socket be silently disconencted).

PeerManager

A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket events into messages which it passes on to its MessageHandlers.

Traits

SocketDescriptor

Provides an object which can be used to send data to and which uniquely identifies a connection to a remote host. You will need to be able to generate multiple of these which meet Eq and implement Hash to meet the PeerManager API.