pub struct ConnectionState {Show 15 fields
pub local_ip: Option<IpAddr>,
pub remote_ip: Option<IpAddr>,
pub peer_address: String,
pub receive_buffer: VecDeque<u8>,
pub paired_connection: Option<ConnectionId>,
pub send_buffer: VecDeque<Vec<u8>>,
pub next_send_time: Duration,
pub flags: ConnectionFlags,
pub cut_expiry: Option<Duration>,
pub close_reason: CloseReason,
pub send_buffer_capacity: usize,
pub send_delay: Option<Duration>,
pub recv_delay: Option<Duration>,
pub half_open_error_at: Option<Duration>,
pub last_data_delivery_scheduled_at: Option<Duration>,
}Expand description
Internal connection state for simulation
Fields§
§local_ip: Option<IpAddr>Local IP address for this connection
remote_ip: Option<IpAddr>Remote IP address for this connection
peer_address: StringPeer address as seen by this connection.
FDB Pattern (sim2.actor.cpp:1149-1175):
- For client-side connections: the destination address (server’s listening address)
- For server-side connections: synthesized ephemeral address (random IP + port 40000-60000)
This simulates real TCP behavior where servers see client ephemeral ports, not the client’s identity address. As FDB notes: “In the case of an incoming connection, this may not be an address we can connect to!”
receive_buffer: VecDeque<u8>FIFO buffer for incoming data that hasn’t been read by the application yet.
paired_connection: Option<ConnectionId>Reference to the other end of this bidirectional TCP connection.
send_buffer: VecDeque<Vec<u8>>FIFO buffer for outgoing data waiting to be sent over the network.
next_send_time: DurationNext available time for sending messages from this connection.
flags: ConnectionFlagsBoolean flags (closure, chaos, send-in-progress) packed into a bitfield.
Use the named accessor methods on ConnectionFlags to inspect or
update individual bits.
cut_expiry: Option<Duration>When the cut expires and the connection is restored (in simulation time).
Only meaningful when flags.is_cut() is true.
close_reason: CloseReasonReason for connection closure - distinguishes FIN vs RST semantics.
When flags.is_closed() is true, this indicates whether it was graceful or aborted.
send_buffer_capacity: usizeSend buffer capacity in bytes.
When the send buffer reaches this limit, poll_write returns Pending.
Calculated from BDP (Bandwidth-Delay Product): latency × bandwidth.
send_delay: Option<Duration>Per-connection send delay override (asymmetric latency).
If set, this delay is applied when sending data from this connection.
If None, the global write_latency from NetworkConfiguration is used.
recv_delay: Option<Duration>Per-connection receive delay override (asymmetric latency).
If set, this delay is applied when receiving data on this connection.
If None, the global read_latency from NetworkConfiguration is used.
half_open_error_at: Option<Duration>When a half-open connection starts returning errors (in simulation time). Before this time: writes succeed (data dropped), reads block. After this time: both read and write return ECONNRESET.
last_data_delivery_scheduled_at: Option<Duration>Time of the most recently scheduled DataDelivery event from this connection.
Used to ensure FinDelivery is scheduled after the last data arrives at the peer.
Trait Implementations§
Source§impl Clone for ConnectionState
impl Clone for ConnectionState
Source§fn clone(&self) -> ConnectionState
fn clone(&self) -> ConnectionState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more