Skip to main content

write_thread

Function write_thread 

Source
fn write_thread(
    rx_channel: Receiver<TcpServerMessage>,
    write_stream: TcpStream,
    connection_id: u64,
)
Expand description

Manages outgoing data serialization and transmission to the client on a dedicated background thread.

Listens on the receive channel for outbound [TcpServerMessage] objects, serializes them, writes their length-prefixed binary representations to the TCP stream, and terminates upon encountering transmission errors or a kick notification.

ยงArguments

  • rx_channel - The receiver channel for pulling queued server-to-client messages.
  • write_stream - The isolated TcpStream clone dedicated to writing data.
  • connection_id - The unique identifier of this connection.