[−][src]Module grin_p2p::msg
Message types that transit over the network and related serialization code.
Structs
BanReason | |
GetPeerAddrs |
Ask for other peers addresses, required for network discovery. |
Hand |
First part of a handshake, sender advertises its version and characteristics. |
Headers |
Serializable wrapper for a list of block headers. |
Locator |
Serializable wrapper for the block locator. |
MsgHeader |
Header of any protocol message, used to identify incoming messages. |
PeerAddrs |
Peer addresses we know of that are fresh enough, in response to GetPeerAddrs. |
PeerError |
We found some issue in the communication, sending an error back, usually followed by closing the connection. |
Ping | |
Pong | |
Shake |
Second part of a handshake, receiver of the first part replies with its own version and characteristics. |
SockAddr |
Only necessary so we can implement Readable and Writeable. Rust disallows implementing traits when both types are outside of this crate (which is the case for SocketAddr and Readable/Writeable). |
TxHashSetArchive |
Response to a txhashset archive request, must include a zip stream of the archive after the message body. |
TxHashSetRequest |
Request to get an archive of the full txhashset store, required to sync a new node. |
Enums
Type |
Constants
HEADER_LEN |
Size in bytes of a message header |
PROTOCOL_VERSION |
Current latest version of the protocol |
USER_AGENT |
Grin's user agent with current version |
Functions
read_body |
Read a message body from the provided connection, always blocking until we have a result (or timeout). |
read_exact |
The default implementation of read_exact is useless with async TcpStream as
it will return as soon as something has been read, regardless of
whether the buffer has been filled (and then errors). This implementation
will block until it has read exactly |
read_header |
Read a header from the provided connection without blocking if the underlying stream is async. Typically headers will be polled for, so we do not want to block. |
read_message |
Reads a full message from the underlying connection. |
write_all |
Same as |
write_message | |
write_to_buf |