Module network

Source
Expand description

Network communication and peer management

This module handles all network-related functionality, including peer discovery, message sending/receiving, and connection management in the distributed system.

Structs§

NETWORK_MANAGER
NetworkManager
Manages network connections and peer communication
PeerConnection
Represents a connection to a peer node

Functions§

announce
Announces this node’s presence to potential peers in the network. If the user gave peers in args, we will only connect to those peers. If not, we will scan the port range and try connecting to all sockets.
diffuse_message
Implement our wave diffusion protocol
diffuse_message_without_lock
Implement our wave diffusion protocol
handle_network_message
Handles incoming messages from a peer Implement our wave diffusion protocol
send_message
Send a message to a specific peer
spawn_writer_task
Spawns a task to handle writing messages to a peer connection
start_listening
Starts listening for messages from a new peer