- Добавлена функция etcp_loadbalancer_get_link_status() для проверки состояния связи
- Клиент: при падении всех линков запускается отправка ETCP_INIT_REQUEST_NOINIT (0x04)
- Сервер: при приеме NOINIT отвечает ETCP_INIT_RESPONSE_NOINIT (0x05) без сброса если линк initialized
- При приеме любого пакета отменяется таймер восстановления
- ETCP_INIT_RESPONSE (0x03) вызывает сброс всего ETCP_CONN
- Переименованы константы: ETCP_CHANNEL_INIT -> ETCP_INIT_REQUEST_NOINIT,
ETCP_CHANNEL_RESPONSE -> ETCP_INIT_RESPONSE_NOINIT
Все 23 теста проходят
- etcp_loadbalancer_select_link() теперь пропускает линки со статусом != 1
- При установке initialized=1 сразу выставляется link_status=1 (up)
- Добавлено логирование при изменении статуса линка на UP
- Add log_name[16] field to ETCP_CONN structure for connection identification
- Add etcp_update_log_name() function to update identifier when peer_node_id is known
- Update all DEBUG_* calls in etcp.c and etcp_loadbalancer.c to include log_name prefix
- Add DEBUG_CATEGORY_NORMALIZER for packet normalizer debug output
- Change log timestamp format to [hh:mm:ss-mmm.uuu] with microseconds precision
- Reorder debug output: (file:line) function() [log_name] message
- Remove duplicate function names from log messages
- Clean up backup files from pkt_normalizer development
Changes:
- ll_queue callback now receives only queue pointer and arg (no data)
- Added log_dump and addr_to_string utility functions
- Removed temporary backup files
- Updated AGENTS.md with additional guidelines
- Fixed compiler warnings in etcp.c and pkt_normalizer.c
- Change xxx from 1 to 0, fixing pointer arithmetic in queue_resume_timeout_cb
- Update comments: callback receives struct ll_entry* not user data
- Rename payload field to data in struct ll_entry
- etcp: fix INFLIGHT_PACKET to ACK_PACKET type in etcp_conn_input
- debug: remove excessive DEBUG_ERROR/DEBUG_DEBUG messages
- tests: rewrite test_ll_queue.c for new architecture
- Fixed incorrect init_connections() call in test_etcp_simple_traffic.c (was calling server_instance instead of client_instance)
- Fixed double free in timeout_heap_pop() when handling deleted elements
- Enhanced NULL pointer safety in uasync_print_resources() by removing complex heap manipulation
- Added debug logging to timeout_heap_pop() for better error tracking
Test results: test_etcp_simple_traffic now passes without double free errors
Added extensive debug logging using DEBUG_* macros to both ETCP and loadbalancer modules:
ETCP Module Debug Output:
- Connection creation/destruction with detailed state tracking
- Packet transmission/reception with ID, size, and timestamp details
- ACK processing with individual ACK entry tracking
- Retransmission request processing with gap detection
- RTT calculation and jitter analysis with history tracking
- Payload processing with duplicate detection
- Measurement sections (MEAS_TS, MEAS_RESP) handling
- Timer operations (retransmission, ACK scheduling)
- Memory management (allocation/free operations)
- Gap detection and contiguous packet delivery
- Bandwidth updates and link state changes
Loadbalancer Module Debug Output:
- Link selection algorithm with timing calculations
- Bandwidth-based load balancing decisions
- Connection initialization and timeout handling
- Link activity tracking and scheduling
- Bandwidth measurement processing
Debug Levels Available:
- TRACE: Function entry/exit, packet-level details
- DEBUG: Operational flow, state changes
- INFO: Important events, connections, errors
- WARN: Warning conditions
- ERROR: Error conditions
Usage examples:
- ./src/utun -d 'etcp:trace' # Maximum ETCP detail
- ./src/utun -d 'etcp:debug,loadbalancer:debug' # Both modules
- ./src/utun -d 'all:debug' # Everything debug level
This comprehensive debug output will help trace all ETCP protocol operations,
packet flows, timing calculations, load balancing decisions, and state changes
for thorough debugging and development of the new modules.
- Added missing structure members to ETCP_CONN (ack_packets_count, last_rx_ack_id, rtt_history, rtt_history_idx, total_packets_sent)
- Added missing bandwidth member to ETCP_LINK structure
- Fixed include path for ll_queue.h header
- Added math library linking (-lm) to build system
- Added etcp_loadbalancer.c to build sources
- Fixed forward declarations and function calls in ETCP modules
- Updated test dependencies to include loadbalancer object files
All simple compilation errors resolved, project builds successfully and tests pass (except TUN permission test which is expected in container).