Remove stale fixture pointer and verify full transmission IDs in packet dumps

This commit is contained in:
evgeny committed 2026-10-23 11:22:37 +02:00
1 parent ddba151aa5
commit ce798a193e
2 files changed
+6 -3

No files matched your search

+4 -1
View File
@@ -48,12 +48,15 @@ static void debug_sequence_boundaries(void) {
pkt->data[0] = ack ? ETCP_SECTION_ACK : ETCP_SECTION_PAYLOAD;
pkt->data_len = ack ? ETCP_ACK_BASE_SIZE : ETCP_PAYLOAD_HEADER_SIZE;
for (int j = 0; j < 4; j++) pkt->data[1 + ack + j] = (uint8_t)(values[i] >> (8 * j));
const uint64_t attempt_id = UINT64_C(0xfedcba9876543210);
if (!ack) for (unsigned j = 0; j < 8; j++) pkt->data[5+j] = (uint8_t)(attempt_id >> (8*j));
if (ack) pkt->data[6] = pkt->data[7] = 255;
dump_count = 0; dump_message[0] = 0;
etcp_dump_pkt_sections(pkt, NULL, 0);
char expected[80];
if (ack) snprintf(expected, sizeof(expected), " ack=%u/0 dup=65535", values[i]);
else snprintf(expected, sizeof(expected), " payload=0(seq=%u)", values[i]);
else snprintf(expected, sizeof(expected), " payload=0(seq=%u attempt=%llu)",
values[i], (unsigned long long)attempt_id);
CHECK(dump_count == 1 && strstr(dump_message, expected));
}
}
+2 -2
View File
@@ -48,7 +48,7 @@ int __wrap_etcp_encrypt_send(struct ETCP_DGRAM* pkt) {
void* __real_memory_pool_alloc_impl(struct memory_pool* pool, const char* location);
void* __wrap_memory_pool_alloc_impl(struct memory_pool* pool, const char* location) {
if (pool == inst.data_pool && fail_rx_data) { fail_rx_data--; return NULL; }
if (conn && pool == conn->io_pool && fail_rx_fragment) { fail_rx_fragment--; return NULL; }
if (fail_rx_fragment && conn && pool == conn->io_pool) { fail_rx_fragment--; return NULL; }
if (pool == inst.ack_pool && fail_ack_entry) { fail_ack_entry--; return NULL; }
if (pool == inst.pkt_pool && fail_alloc) { fail_alloc--; return NULL; }
return __real_memory_pool_alloc_impl(pool, location);
@@ -115,7 +115,7 @@ static void setup(void) {
static void teardown(void) {
check_accounting();
etcp_connection_close(conn);
etcp_connection_close(conn); conn = NULL;
uasync_poll(ua, 0);
queue_free(inst.connections);
memory_pool_destroy(inst.pkt_pool); memory_pool_destroy(inst.data_pool); memory_pool_destroy(inst.ack_pool);