ble-reticulum/tests
torlando-tech 73be6d93c0 feat: add zombie connection detection to break symmetric deadlock
When BLE link degrades, 1-byte keepalives may still work while larger data
packets fail. Both sides think the connection is "alive" based on keepalives,
but data can't flow. This causes a deadlock where new connections are
rejected as "duplicates" even though the existing connection is non-functional.

This change adds zombie detection by tracking when real data (not keepalives)
was last received. If an existing connection has only exchanged keepalives
for > 30 seconds (configurable via _zombie_timeout), new connections from
the same identity are allowed and the zombie connection is disconnected.

Changes:
- Add _last_real_data dict to track last real data timestamp per identity
- Add _zombie_timeout (default 30s) for configurable zombie threshold
- Update _check_duplicate_identity with Check 3: zombie detection
- Update _handle_ble_data to track real data activity after keepalive filter
- Initialize tracking in _handle_identity_handshake and _spawn_peer_interface
- Clean up tracking in _process_pending_detaches
- Add comprehensive test suite for zombie detection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 12:47:45 -05:00
..
conftest.py fix: update paths in installer, tests, and workflows for package rename 2025-12-29 23:58:18 -05:00
mock_ble_driver.py fix(tests): update tests for driver callback signature and Python 3.14 compatibility 2026-01-18 01:26:57 -05:00
test_ble_duplicate_identity_stale.py fix: verify connection is still alive before rejecting duplicate identity 2026-01-18 03:34:17 -05:00
test_ble_peer_interface.py fix(tests): update tests for driver callback signature and Python 3.14 compatibility 2026-01-18 01:26:57 -05:00
test_bleak_threading_hang.py Initial commit: BLE Reticulum interface 2025-10-26 19:14:14 -04:00
test_bleak_with_exec_loading.py Initial commit: BLE Reticulum interface 2025-10-26 19:14:14 -04:00
test_bluez_state_cleanup.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_breddr_fallback_prevention.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_config_directory.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_dbus_disconnect_monitoring.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_error_recovery.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_fragmentation.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_gatt_server.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_gatt_server_readiness.py fix(ble): Add D-Bus verification to prevent GATT server initialization race 2025-11-10 19:51:23 -05:00
test_hci_error_fixes.py fix: update paths in installer, tests, and workflows for package rename 2025-12-29 23:58:18 -05:00
test_identity_cache.py feat: add zombie connection detection to break symmetric deadlock 2026-01-18 12:47:45 -05:00
test_identity_hash.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_identity_mapping_cleanup.py fix: Clean up identity mappings on disconnect to prevent stale connections 2025-11-13 15:37:54 -05:00
test_installer.sh refactor: make libffi-dev conditional for armhf (32-bit ARM) only 2025-10-29 11:02:51 -04:00
test_integration.py fix: update paths in installer, tests, and workflows for package rename 2025-12-29 23:58:18 -05:00
test_interface_cleanup.py feat: add zombie connection detection to break symmetric deadlock 2026-01-18 12:47:45 -05:00
test_mac_rotation_blacklist_bug.py feat: add zombie connection detection to break symmetric deadlock 2026-01-18 12:47:45 -05:00
test_multi_device_simulation.py Initial commit: BLE Reticulum interface 2025-10-26 19:14:14 -04:00
test_peer_address_mac_rotation.py fix(tests): update tests for driver callback signature and Python 3.14 compatibility 2026-01-18 01:26:57 -05:00
test_peripheral_disconnect_cleanup.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_prioritization.py fix: update paths in installer, tests, and workflows for package rename 2025-12-29 23:58:18 -05:00
test_scanner_connection_coordination.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_stale_connection_polling.py refactor: rename package from RNS.Interfaces to ble_reticulum 2025-12-29 23:30:07 -05:00
test_v2_2_identity_handshake.py fix(tests): update tests for driver callback signature and Python 3.14 compatibility 2026-01-18 01:26:57 -05:00
test_v2_2_mac_sorting.py test: fix test suite for BLE interface changes 2026-01-01 14:03:59 -05:00
test_v2_2_race_conditions.py fix(tests): update tests for driver callback signature and Python 3.14 compatibility 2026-01-18 01:26:57 -05:00
test_zombie_connection_detection.py feat: add zombie connection detection to break symmetric deadlock 2026-01-18 12:47:45 -05:00