Fix repeater telemetry loss due to race condition in timeout handlers#63
Merged
MrAlders0n merged 3 commits intodevfrom Dec 19, 2025
Merged
Fix repeater telemetry loss due to race condition in timeout handlers#63MrAlders0n merged 3 commits intodevfrom
MrAlders0n merged 3 commits intodevfrom
Conversation
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix session ping log output for accuracy
Fix repeater telemetry loss due to race condition in timeout handlers
Dec 19, 2025
Collaborator
|
@copilot I dont want to round up the SNR, put the exact SNR values as received |
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Session Pings log displayed "none" for repeaters despite debug logs showing successful detection (e.g.,
path=4e, SNR=11.5andpath=77, SNR=9.75).Root Cause
Two 7-second timeouts fired sequentially:
startRepeaterTracking()set a timeout that calledstopRepeaterTracking(), clearing the collected datasendPing()set another timeout that calledstopRepeaterTracking()to retrieve results, but found an empty array due toisListening = falseChanges
startRepeaterTracking()sendPing()now handles both stopping and retrieval atomicallyBefore:
After:
Session log now populates correctly with exact SNR values:
2025-12-19T04:59:55.537Z | 45.26900,-75.77755 | 4e(11.5),77(9.75)Original prompt
The last PR seems to be working base don console logging,
However the session ping log shows this
Session Pings
2025-12-19T04:59:55.537Z | 45.26900,-75.77755 | none
[DEBUG] Starting 7000ms cooldown
wardrive.js:18 [DEBUG] Scheduling MeshMapper API post in 7000ms
wardrive.js:18 [DEBUG] Calculating Haversine distance: (45.26900, -75.77755) to (45.26900, -75.77755)
wardrive.js:18 [DEBUG] Haversine distance calculated: 0.00m
wardrive.js:18 [DEBUG] Calculating Haversine distance: (45.26900, -75.77755) to (45.26900, -75.77755)
wardrive.js:18 [DEBUG] Haversine distance calculated: 0.00m
wardrive.js:18 [DEBUG] Received rx_log entry: SNR=11.5, RSSI=-36
wardrive.js:18 [DEBUG] Parsed packet: header=0x15, route_type=FLOOD, payload_type=GRP_TXT, path_len=1
wardrive.js:18 [DEBUG] Header validation passed: 0x15
wardrive.js:18 [DEBUG] Message correlation check: packet_channel_hash=0x81, expected=0x81
wardrive.js:18 [DEBUG] Channel hash match confirmed - this is a message on our channel
wardrive.js:18 [DEBUG] [MESSAGE_CORRELATION] Starting message content verification...
wardrive.js:18 [DEBUG] [MESSAGE_CORRELATION] Channel key available, attempting decryption...
wardrive.js:18 [DEBUG] [DECRYPT] Starting GroupText payload decryption
wardrive.js:18 [DEBUG] [DECRYPT] Payload length: 67 bytes
wardrive.js:18 [DEBUG] [DECRYPT] Channel key length: 16 bytes
wardrive.js:18 [DEBUG] [DECRYPT] Channel hash: 0x81
wardrive.js:18 [DEBUG] [DECRYPT] Cipher MAC: a37c
wardrive.js:18 [DEBUG] [DECRYPT] Encrypted data length: 64 bytes
wardrive.js:18 [DEBUG] [DECRYPT] Encrypted data preview (first 32 bytes): 640cd519e3cd2365d2dee2dc72210449d79ff9216519d973f80ce73cb4685cbf...
wardrive.js:18 [DEBUG] [DECRYPT] Using aes-js library for AES-ECB decryption
wardrive.js:18 [DEBUG] [DECRYPT] Decrypting 64 bytes with AES-ECB...
wardrive.js:18 [DEBUG] [DECRYPT] Decryption completed successfully
wardrive.js:18 [DEBUG] [DECRYPT] Decrypted data length: 64 bytes
wardrive.js:18 [DEBUG] [DECRYPT] Decrypted data preview (first 32 bytes): cb db 44 69 00 4d 72 41 6c 64 65 72 73 30 6e 3a 20 40 5b 4d 61 70 70 65 72 42 6f 74 5d 20 34 35...
wardrive.js:18 [DEBUG] [DECRYPT] Timestamp: 1766120395 (2025-12-19T04:59:55.000Z)
wardrive.js:18 [DEBUG] [DECRYPT] Flags: 0x00
wardrive.js:18 [DEBUG] [DECRYPT] Message bytes length: 59
wardrive.js:18 [DEBUG] [DECRYPT] ✅ Message decrypted successfully: "MrAlders0n: @[MapperBot] 45.26900, -75.77755"
wardrive.js:18 [DEBUG] [DECRYPT] Message length: 44 characters
wardrive.js:18 [DEBUG] [MESSAGE_CORRELATION] Decryption successful, comparing content...
wardrive.js:18 [DEBUG] [MESSAGE_CORRELATION] Decrypted: "MrAlders0n: @[MapperBot] 45.26900, -75.77755" (44 chars)
wardrive.js:18 [DEBUG] [MESSAGE_CORRELATION] Expected: "@[MapperBot] 45.26900, -75.77755" (32 chars)
wardrive.js:18 [DEBUG] [MESSAGE_CORRELATION] ✅ Message contained in decrypted text (with sender prefix) - this is an echo of our ping!
wardrive.js:18 [DEBUG] Repeater echo accepted: path=4e, SNR=11.5, path_length=1
wardrive.js:18 [DEBUG] Adding new repeater echo: path=4e, SNR=11.5
wardrive.js:18 [DEBUG] Received rx_log entry: SNR=9.75, RSSI=-21
wardrive.js:18 [DEBUG] Parsed packet: header=0x15, route_type=FLOOD, payload_type=GRP_TXT, path_len=1
wardrive.js:18 [DEBUG] Header validation passed: 0x15
wardrive.js:18 [DEBUG] Message correlation check: packet_channel_hash=0x81, expected=0x81
wardrive.js:18 [DEBUG] Channel hash match confirmed - this is a message on our channel
wardrive.js:18 [DEBUG] [MESSAGE_CORRELATION] Starting message content verification...
wardrive.js:18 [DEBUG] [MESSAGE_CORRELATION] Channel key available, attempting decryption...
wardrive.js:18 [DEBUG] [DECRYPT] Starting GroupText payload decryption
wardrive.js:18 [DEBUG] [DECRYPT] Payload length: 67 bytes
wardrive.js:18 [DEBUG] [DECRYPT] Channel key length: 16 bytes
wardrive.js:18 [DEBUG] [DECRYPT] Channel hash: 0x81
wardrive.js:18 [DEBUG] [DECRYPT] Cipher MAC: a37c
wardrive.js:18 [DEBUG] [DECRYPT] Encrypted data length: 64 bytes
wardrive.js:18 [DEBUG] [DECRYPT] Encrypted data preview (first 32 bytes): 640cd519e3cd2365d2dee2dc72210449d79ff9216519d973f80ce73cb4685cbf...
wardrive.js:18 [DEBUG] [DECRYPT] Using aes-js library for AES-ECB decryption
wardrive.js:18 [DEBUG] [DECRYPT] Decrypting 64 bytes with AES-ECB...
wardrive.js:18 [DEBUG] [DECRYPT] Decryption completed successfully
wardrive.js:18 [DEBUG] [DECRYPT] Decrypted data length: 64 bytes
wardrive.js:18 [DEBUG] [DECRYPT] Decrypted data preview (first 32 bytes): cb db 44 69 00 4d 72 41 6c 64 65 72 73 30 6e 3a 20 40 5b 4d 61 70 70 65 72 42 6f 74 5d 20 34 35...
wardrive.js:18 [DEBUG] [DECRYPT] Timestamp: 1766120395 (2025-12-19T04:59:55.000Z)
wardrive.js:18 [DEBUG] [DECRYPT] Flags: 0x00
wardrive.js:18 [DEBUG] [DECRYPT] Message bytes length: 59
wardrive.js:18 [DEBUG] [DECRYPT] ✅ Message decrypted successfully: "MrAlders0n: @[MapperBot] 45.26900, -75.77755"
wardrive.js:18 [DEBUG] [DECRYPT] Message length: 44 characters
wardrive.js:18 [DEBUG] [MESSAGE_CORRELA...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.