docs: late_resequenced counts held-then-delivered packets, not gaps avoided

Fix the false trailing clause in the udps_stats_t::late_resequenced comment,
move udps_held_t from the tunable-limits section to internal-state next to
udps_slot_t, and add braces to three braceless if bodies to match house style.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino FerrariandClaude Sonnet 4.6 committed 2026-10-08 17:44:13 +02:00
1 parent 6e79a67252
commit 45958a441a
2 files changed
+19 -14

No files matched your search

+13 -12
View File
@@ -38,15 +38,6 @@
/** Total bytes the reorder ring may hold, so a fast stream cannot grow it without bound. */ /** Total bytes the reorder ring may hold, so a fast stream cannot grow it without bound. */
#define UDPS_REORDER_BYTES (4u * 1024u * 1024u) #define UDPS_REORDER_BYTES (4u * 1024u * 1024u)
typedef struct {
uint8_t *buf; /**< owned; grown on demand to the payload's length */
size_t cap;
size_t len;
uint32_t counter;
double recv_time;
int used;
} udps_held_t;
/** Concurrent in-flight reassemblies. The server interleaves at most a couple. */ /** Concurrent in-flight reassemblies. The server interleaves at most a couple. */
#define UDPS_MAX_SLOTS 4 #define UDPS_MAX_SLOTS 4
@@ -165,6 +156,16 @@ typedef struct {
double first_seen; double first_seen;
} udps_slot_t; } udps_slot_t;
/** One slot in the reorder ring: a raw payload held until its counter is next. */
typedef struct {
uint8_t *buf; /**< owned; grown on demand to the payload's length */
size_t cap;
size_t len;
uint32_t counter;
double recv_time;
int used;
} udps_held_t;
struct udps_client { struct udps_client {
udps_client_config_t cfg; udps_client_config_t cfg;
/* Owned copies: the caller's strings need not outlive the create call. */ /* Owned copies: the caller's strings need not outlive the create call. */
@@ -747,7 +748,7 @@ static int order_data(udps_client_t *c, const uint8_t *pl, size_t len,
if (delta == 0) { if (delta == 0) {
int rc = deliver_data(c, pl, len, counter, recv_time, 0u, 0); int rc = deliver_data(c, pl, len, counter, recv_time, 0u, 0);
c->next_counter = counter + 1u; c->next_counter = counter + 1u;
if (rc == 0) rc = drain_held(c, 0u); if (rc == 0) { rc = drain_held(c, 0u); }
return rc; return rc;
} }
if (delta > 0) { if (delta > 0) {
@@ -1364,8 +1365,8 @@ int udps_client_poll(udps_client_t *c, int timeout_ms) {
* the next arrival is 100 ms away, which is five times the whole budget. */ * the next arrival is 100 ms away, which is five times the whole budget. */
if (c->gap_deadline > 0.0) { if (c->gap_deadline > 0.0) {
double left = c->gap_deadline - now_wall(); double left = c->gap_deadline - now_wall();
if (left < 0.0) left = 0.0; if (left < 0.0) { left = 0.0; }
if (left < budget) budget = left; if (left < budget) { budget = left; }
} }
FD_ZERO(&rset); FD_ZERO(&rset);
+6 -2
View File
@@ -188,8 +188,12 @@ typedef struct {
*/ */
uint64_t stale_packets; uint64_t stale_packets;
/** /**
* DATA packets that arrived out of order and were put *back* in order inside * DATA packets that were held waiting for an earlier counter and subsequently
* the reorder window, so the consumer never saw a gap for them. * delivered via @c drain_held(). This includes a packet released by the
* reorder window expiring: that packet arrives alongside a non-zero @c lost
* and therefore alongside a gap, so @c late_resequenced is not by itself a
* count of gaps avoided. Compare @c late_delivered, which counts packets
* that lost the race past an already-expired window entirely.
*/ */
uint64_t late_resequenced; uint64_t late_resequenced;
/** /**