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

Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+19 -13
View File
@@ -155,25 +155,31 @@ static void check_packet_received(void) {
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: Server output_queue count: %d", queue_entry_count(conn->output_queue));
// Check if there's any packet in output queue
void* data = queue_data_get(conn->output_queue);
if (data) {
struct ETCP_FRAGMENT* pkt = queue_data_get(conn->output_queue);
if (pkt) {
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: Found packet in output queue");
// В новом API размер данных нужно получать из структуры
struct ll_entry* entry = (struct ll_entry*)data - 1;
size_t size = entry->size;
// ETCP_FRAGMENT содержит ll_entry в начале, данные в pkt_data
size_t size = pkt->ll.size;
uint8_t* data = pkt->pkt_data;
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: Packet size=%zu, expected=%d", size, PACKET_SIZE);
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: First byte received=%02X, expected=%02X",
((uint8_t*)data)[0], test_packet_data[0]);
if (size == PACKET_SIZE && memcmp(data, test_packet_data, PACKET_SIZE) == 0) {
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: First byte received=%02X, expected=%02X",
data[0], test_packet_data[0]);
// Проверяем только данные (первые PACKET_SIZE байт), размер может включать ETCP заголовки
if (size >= PACKET_SIZE && memcmp(data, test_packet_data, PACKET_SIZE) == 0) {
packet_received = 1;
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "check_packet_received: SUCCESS - Packet received in server output queue (%zu bytes), data matches", size);
} else {
DEBUG_WARN(DEBUG_CATEGORY_ETCP, "check_packet_received: Packet received but size mismatch or data differs (expected %d, got %zu)", PACKET_SIZE, size);
DEBUG_WARN(DEBUG_CATEGORY_ETCP, "check_packet_received: Packet received but data differs (expected %d bytes, got %zu)", PACKET_SIZE, size);
}
queue_data_free(data);
// Освобождаем ETCP_FRAGMENT и данные
if (pkt->pkt_data) {
memory_pool_free(conn->instance->data_pool, pkt->pkt_data);
}
queue_data_free(pkt);
} else {
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "check_packet_received: No packet found in output queue");
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.