Skip to main content

read_thread

Function read_thread 

Source
fn read_thread(
    stream: &mut TcpStream,
    connection_id: u64,
    tx_channel: &Sender<TcpServerMessage>,
)
Expand description

Continuously reads, deserializes, and processes incoming messages from an active client connection.

Handles session authorization enforcement, delegates requests to appropriate message handlers, and performs cleanup operations (updating session status to sleeping) when the client disconnects.

§Arguments

  • stream - A mutable reference to the client’s TcpStream.
  • connection_id - The unique identifier of this connection.
  • tx_channel - The message sender channel used to push asynchronous server responses to the tcp writer thread.