- 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).