Skip to main content

Crate voltlane_net

Crate voltlane_net 

Source
Expand description

This module provides utilities for working with TCP sockets in an asynchronous context using Tokio. It handles sending and receiving size-prefixed messages and packets with client IDs. The module ensures cancellation safety where applicable, allowing for robust handling of asynchronous operations.

If you call ANYTHING from this module, make SURE to read the notes about cancellation safety in each doc comment. If you don’t, you will be cursed and your code will be haunted by the ghosts of the braincells who had to die in the tens of hours of work debugging and testing this code to make sure it’s cancellation safe where needed.

If you want to touch this, read up on cancellation safety in Rust and the Tokio documentation, first. Then, grab a {drink_of_choice}, block a time slot of a few hours, and enjoy yourself. Finally, make sure you can explain why the code is the way it is before you change it. And please, don’t assume that it was ever correct; so if you find a bug, it’s probably real.

Enums§

ClientServerPacket
TaggedPacket

Constants§

PROTOCOL_VERSION

Functions§

configure_performance_tcp_socket
Configures a TCP socket for performance by setting relevant socket options.
new_framed_reader
recv_size_prefixed
Receives a size-prefixed message.
recv_tagged_packet
Receives a packet with a client id.
send_size_prefixed
send_tagged_packet
Sends a packet with a client id.

Type Aliases§

FramedReader