Commit Graph
6 Commits
Author SHA1 Message Date
Evgeny 3ddfb79338 Backup before replacing all printf with DEBUG_ macros in tests 2026-01-26 17:52:50 +03:00
Evgeny 1bafe6a681 Backup before fixing etcp_connections list addition 2026-01-26 17:40:51 +03:00
Evgeny d74f76a5a0 Fix: Resolved double free in timeout_heap_pop() and test_etcp_simple_traffic bind conflict
- 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
2026-01-25 10:47:02 +03:00
Evgeny f1a76c9d30 Fix memory leaks and crashes in ETCP tests
✅ Fixed critical segmentation fault (SIGABRT) in test_etcp_two_instances
✅ Added comprehensive timer debug logging with DEBUG_CATEGORY_TIMERS
✅ Created uasync_print_resources() function for resource diagnostics
✅ Created utun_instance_diagnose_leaks() function for leak analysis
✅ Fixed cleanup order - cancel timers before destroying uasync instances
✅ Fixed timer cancellation to properly update counters
✅ Fixed socket cleanup to unregister from uasync before destruction
✅ Added detailed diagnostic output for memory leak tracking
✅ All tests now pass without crashes

Key fixes:
- Fixed use-after-free in test cleanup sequence
- Added proper timer leak detection and cleanup
- Enhanced debug capabilities for future debugging
- Fixed ETCP socket cleanup to prevent resource leaks

The test_etcp_two_instances now runs successfully without segmentation faults.
2026-01-22 00:57:45 +03:00
Evgeny 3f0a23aa93 Fix build: rename u_async to lib, add missing constants, out-of-tree build support 2026-01-18 16:18:28 +03:00
Evgeny 8d9340c949 Refactor: Move mainloop from utun_instance to main
Major architectural changes:
- utun_instance_run() now does single iteration instead of mainloop
- Added tun_read_callback() to handle TUN device packets
- Added utun_instance_register_sockets() for uasync integration
- Mainloop moved to main() with proper signal handling
- Removed parse config file functions from debug_config
- all fprintf replaced with DEBUG_* macros

Files changed:
- src/utun.c: Added mainloop, signal handlers, proper init order
- src/utun_instance.c: Added callback, socket registration, single-run
- src/utun_instance.h: Added declarations, tun_socket_id field
- u_async/debug_config.c: Removed file parsing and auto-reload
- u_async/debug_config.h: Removed file functions, added categories
- changelog.txt: Added all changes

Breaking changes:
- debug_parse_config_file() removed (use debug_parse_config() only)
- etcp crypto integration needs fixing (separate issue)

AGENTS.md principles followed:
- No backward compatibility preserved
- Removed 103+ lines of legacy code
- Added statistics tracking
- Clean architecture: create -> init -> register -> run -> destroy
2026-01-18 14:28:57 +03:00