Repository navigation
reliable 1.4.6: tracking buffers are capped and rounded to a power of two, and creation refuses smoothing factors outside [0,1]
Latestreliable 1.4.6: tracking buffers are capped and rounded to a power of two, and creation refuses smoothing factors outside [0,1]
Nothing on the wire changes, and no public function, struct field or counter index changes. What changes is what reliable_endpoint_create accepts and a few receive-path behaviours.
Configuration. reliable_endpoint_create returns NULL when sent_packets_buffer_size, received_packets_buffer_size or fragment_reassembly_buffer_size is above 16384, when rtt_smoothing_factor, packet_loss_smoothing_factor or bandwidth_smoothing_factor is outside [0,1] or NaN, and when packet_header_size + max_packet_size leaves no room for both packet headers within an int. Each of the three tracking buffers is now allocated at its size rounded up to the next power of two, so the sequence-to-slot mapping stays continuous across the 65535 -> 0 wrap. The stale and duplicate window, the sent packet window and the number of reassembly slots (and their memory) are the rounded size; the statistics still sample the configured size. Powers of two behave exactly as before. Reset and destroy walk the rounded reassembly size.
Receive path. reliable_endpoint_receive_packet with packet_bytes <= 0 counts RELIABLE_ENDPOINT_COUNTER_NUM_PACKETS_INVALID and returns, where it used to assert. An rtt sample taken after the clock stepped backwards is clamped to 0 rather than asserted. Five routine wire-driven events now log at debug level instead of error: an oversized payload, a rejected packet, a stale reassembly insert, a fragment count mismatch and a fragment already received. Storing fragment data now reports success, and the fragment is marked received only when it was stored; on failure the fragment is logged, counted RELIABLE_ENDPOINT_COUNTER_NUM_FRAGMENTS_INVALID and dropped. The last fragment's copy bound in send compares lengths rather than pointers (no behaviour change).
Header. reliable.h includes <stdlib.h> in debug builds, and reliable.c checks for it, so pair this reliable.c with this reliable.h. The header now documents the buffer size cap and rounding, the fragment configuration both peers must share, monotonic time for update, acks on rejected packets, and how bandwidth is counted.
Tests. The soak run goes from 8192 to 70000 iterations (well past the sequence wrap), the fuzz harness checks payload integrity and delivery and ack invariants, and the unit tests assert exact rtt, jitter, packet loss and bandwidth values and walk small buffers across the wrap.