Module saito_rust::peer[][src]

Structs

An inbound Peer. This holds a Stream(Sender/Sink) for a peer which has initialized a connection to us via /wsopen.

An outbound Peer. This holds a Stream(Sender/Sink) for a peer which we have connected to via /wsopen. TODO: Unify InboundPeer and OutboundPeer into a single trait and perhaps integrate it into SaitoPeer. This has proven to be a very difficult task because of ownership loops that make it very tricky to interact with a peer by reading messages from a socket which is inside the peer. This is why we have a separate structure to hold the sockets vs the rest of the peer data. It may be easy to at least unify Inbound and Outbound into a single Trait though and merge InboundPeersDB and OutboundPeersDB

Flags for Peer state.

A Peer. i.e. another node in the network.

Functions

spawns a task to read messages from the socket of inbound peers.

Sends an APIMessage to a socket connection. Since Outbound and Inbound peers Streams(Sinks) are not unified into a single Trait yet, we must check both dbs to find out which sort of sink this peer is using and send the message through the appopriate stream.

Type Definitions