Fix ETCP test: server connection registration and packet handling

- etcp_connections.c: Add incoming server connections to instance->connections list
- test_etcp_simple_traffic.c: Fix ETCP_FRAGMENT handling in check_packet_received()
- test_etcp_simple_traffic.c: Fix packet size check (ETCP adds headers to payload)
- Reduced debug verbosity in ll_queue.c and debug_config.c
This commit is contained in:
Evgeny committed 2026-01-28 20:49:14 +03:00
1 parent a34035f41f
commit 985ed5c4b1
18 files changed
+34 -24

No files matched your search

+4 -4
View File
@@ -38,10 +38,10 @@ void log_dump(const char* prefix, const uint8_t* data, size_t len) {
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "%s: len=%zu hex=%s", prefix, len, hex_buf);
// Additional debug info for first few bytes
if (len >= 2) {
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "%s: first_bytes=%02x%02x last_bytes=%02x%02x",
prefix, data[0], data[1], data[len-2], data[len-1]);
}
// if (len >= 2) {
// DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "%s: first_bytes=%02x%02x last_bytes=%02x%02x",
// prefix, data[0], data[1], data[len-2], data[len-1]);
// }
}
+6 -7
View File
@@ -117,7 +117,7 @@ void* queue_data_new(size_t data_size) {
entry->ref_count = 1; // Единственная ссылка - на сам элемент
entry->pool = NULL; // Выделено через malloc
DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "queue_data_new: created entry %p, size=%zu", entry, data_size);
// DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "queue_data_new: created entry %p, size=%zu", entry, data_size);
return (void*)(entry + xxx);
}
@@ -133,7 +133,7 @@ void* queue_data_new_from_pool(struct memory_pool* pool) {
entry->ref_count = 1; // Единственная ссылка - на сам элемент
entry->pool = pool; // Выделено из пула
DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "queue_data_new_from_pool: created entry %p from pool %p", entry, pool);
// DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "queue_data_new_from_pool: created entry %p from pool %p", entry, pool);
return (void*)(entry + xxx);
}
@@ -143,7 +143,7 @@ void queue_data_free(void* data) {
struct ll_entry* entry = data_to_entry(data);
DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "queue_data_free: freeing entry %p, ref_count=%d", entry, entry->ref_count);
// DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "queue_data_free: freeing entry %p, ref_count=%d", entry, entry->ref_count);
if (--entry->ref_count <= 0) {
if (entry->pool) {
@@ -185,8 +185,7 @@ static void remove_from_hash(struct ll_queue* q, struct ll_entry* entry) {
static void check_waiters(struct ll_queue* q) {
if (!q) return;
DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "check_waiters: checking waiters, count=%d, bytes=%zu",
q->count, q->total_bytes);
// DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "check_waiters: checking waiters, count=%d, bytes=%zu", q->count, q->total_bytes);
struct queue_waiter* waiter = &q->waiter;
@@ -230,7 +229,7 @@ int queue_data_put(struct ll_queue* q, void* data, uint32_t id) {
// ВАЖНО: НЕ увеличиваем ref_count - элемент просто находится в очереди
size_t send_q_bytes = queue_total_bytes(q);
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "qqqq check total bytes: new_q_len=%d element_size:%d", send_q_bytes, entry->size);
// DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check total bytes: new_q_len=%d element_size:%d", send_q_bytes, entry->size);
add_to_hash(q, entry);
@@ -398,7 +397,7 @@ int queue_remove_data(struct ll_queue* q, void* data) {
remove_from_hash(q, entry);
DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "queue_remove_data: removed entry %p (id=%u), count=%d", entry, entry->id, q->count);
// DEBUG_DEBUG(DEBUG_CATEGORY_LL_QUEUE, "queue_remove_data: removed entry %p (id=%u), count=%d", entry, entry->id, q->count);
return 0;
}