
AddPeer method concurrently.
Once a connection is fully established, each Peer instance runs a send and a
receive routines.
The send routine collects messages from multiple reactors to a peer, packaging
then into raw messages which are transmitted to the peer.
The receive routine processes incoming messages and forwards them to the
destination reactors, invoking the depicted Receive methods.
In addition, the reactors run multiple routines for interacting
with the peers (for example, to send messages to them) or with the Switch.
The remaining of the documentation is organized as follows:
-
Reactor API: documents the
p2p.Reactorinterface and specifies the behaviour of the p2p layer when interacting with a reactor. In other words, the interaction of the p2p layer with the protocol layer (bottom-up). -
P2P API: documents the interface provided by the p2p
layer to the reactors, through the
SwitchandPeerabstractions. In other words, the interaction of the protocol layer with the p2p layer (top-down).