Commit graph

204 commits

Author SHA1 Message Date
Matthew Wolter
eb2598400a G7: R05 — widen MeshCore.subscribe callback annotation to match dispatcher
Why: MeshCore.subscribe typed callbacks as Callable[[Event], Coroutine[...]]
(async only), while EventDispatcher.subscribe typed them as
Callable[[Event], Union[None, asyncio.Future]] (sync or async). Type-checkers
flag any sync handler passed through MeshCore.subscribe. Fix: align the
annotation to match EventDispatcher's union type; remove unused Coroutine import.

Refs: Forensics report finding R05
2026-04-12 04:52:28 -07:00
Matthew Wolter
168e613ed7 G7: R03 — pre-register binary request before send() to close race window
Why: send_binary_req() registered the pending request with the reader AFTER
send() returned. If a BINARY_RESPONSE arrives between send() returning and
registration (reachable for TCP-companion proxies), the reader logs "No tracked
request found" and the caller's wait_for_event times out. Fix: pre-register a
placeholder keyed by object id before send(), then swap it for the real tag
from MSG_SENT. On send() failure, the placeholder is cleaned up.

Refs: Forensics report finding R03
2026-04-12 04:52:19 -07:00
Matthew Wolter
aed7db21b3 G7: M03+M05+M07 — cleanup: TypeError guard, dead code removal, None normalization
Why: Three minor cleanup fixes. M03 adds an else branch in set_flood_scope so
unsupported scope types raise TypeError instead of UnboundLocalError. M05 removes
the dead `out_path_len >> 6` shift in update_contact (high bits always zero due
to reader masking) and initializes path_hash_mode=0 explicitly. M07 normalizes
three `return None` paths in get_contacts to return Event(EventType.ERROR, ...)
so callers can rely on the return type always being Event.

Refs: Forensics report findings M03, M05, M07
2026-04-12 04:52:07 -07:00
Matthew Wolter
4204bf090c G7: F09 — bump DEFAULT_TIMEOUT from 5s to 15s
Why: 5 seconds is too short for slow-path mesh operations (path-resolving
messaging, long binary responses, remote auth). Also the root cause of tests
that appeared to "hang" — they were falling through to the 5s timeout because
their mock dispatchers don't wire matching responses. Landed as a separate
commit so reviewers can drop it independently if they push back.

Refs: Forensics report finding F09
2026-04-12 04:51:54 -07:00
Matthew Wolter
0709b9f650 G7: F13 — remove broken deprecated req_mma method
Why: req_mma() references undefined variables `start` and `end`, causing a
NameError on every call. The logger.error migration warning confirms the method
is intentionally deprecated in favor of req_mma_sync. Since it is broken as
shipped, removing it cannot break any working caller.

Refs: Forensics report finding F13
2026-04-12 04:51:06 -07:00
Alex Wolden
5e9cb559e7 Use firmware suggested_timeout for login and path discovery sync methods
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 21:42:21 -07:00
Alex Wolden
20f3bccb58 Deprecate fire-and-forget mesh request methods
Add warnings to send_login, send_statusreq, send_telemetry_req, and
send_path_discovery pointing users to their _sync counterparts. The
fire-and-forget versions bypass the mesh request lock and can cause
silent response drops due to firmware clearPendingReqs() behavior.
2026-04-05 18:38:06 -07:00
Alex Wolden
ab3e507e1f Add mesh request lock to serialize firmware-bound mesh commands
The companion firmware can only track one outstanding mesh request at a
time — clearPendingReqs() zeros all pending response flags before each
outgoing mesh request. Overlapping mesh commands cause silent response
drops.

Adds _mesh_request_lock to CommandHandlerBase and wraps all _sync
methods with it. Also adds send_login_sync and send_path_discovery_sync
for complete round-trip serialization of those commands.

Local commands (get_bat, get_channel, set_time, send_msg, etc.) are
unaffected — they don't trigger clearPendingReqs() on the firmware.
2026-04-04 23:18:21 -07:00
Florent
40a70222c8 don't put chan_name in log_rx if we don't know it 2026-03-29 10:53:43 -04:00
Florent
be3aa103c5 adds more min_timeout when fetching lots of neighbours 2026-03-29 07:57:08 -04:00
Florent
fe5096eb9e add hashtag to scope if absent 2026-03-27 20:12:15 -04:00
Florent
eca375dc8a apply frame header fix to tcp as well 2026-03-22 12:51:01 -04:00
fdlamotte
52ad5c201c
Merge pull request #67 from jkingsman/respect-found-idx
Use the frame start once we've found it
2026-03-22 12:48:11 -04:00
Jack Kingsman
4df3655752
Use the frame start once we've found it 2026-03-21 21:08:04 -07:00
Jack Kingsman
3ad77d364d
Fix three byte path packets 2026-03-18 17:31:17 -07:00
Florent
5bfe63912c set decrypt_channel_logs to False by default 2026-03-11 10:21:29 -04:00
Florent
3c81f67608 uploading missing file 2026-03-09 20:58:43 -04:00
Florent
18528f2ed3 make a class and module for parsing meshcore packets 2026-03-09 18:22:02 -04:00
Florent
f3fce820fc fix error 2026-03-08 15:11:24 -04:00
Florent
5e4663d058 there is still a strange bug with path_len 2026-03-08 08:21:56 -04:00
Florent
01471c0d24 fix nasty bug when updating contact flags 2026-03-08 07:04:33 -04:00
Florent
cda44ae0a0 and if error message does not exist yet 2026-03-07 21:13:30 -04:00
Florent
fe2239a8c6 add code_string to error event 2026-03-07 21:05:00 -04:00
Florent
462c4311d3 implement advert_path 2026-03-07 17:42:41 -04:00
josh
3358916e4c f-string quote fix 2026-03-07 13:58:03 +11:00
Florent
0bfa8003d5 remove some debug printfs 2026-03-06 11:11:54 -04:00
Florent
c378319252 some work on multibytes 2026-03-06 10:40:14 -04:00
Florent
f57cb66277 fix silly bug 2026-03-06 08:27:26 -04:00
Florent
563cbfbade complet channel log rx and use timestamp to calculate hashes 2026-03-05 21:32:24 -04:00
Florent
a83956ec1f some optimizations 2026-03-05 15:37:54 -04:00
Florent
322736024a fix 2026-03-05 14:53:43 -04:00
Florent
91be955044 error when msg_hash was not here 2026-03-05 14:41:19 -04:00
Florent
9f66885594 verify if channels has hashes ... 2026-03-05 13:56:29 -04:00
Florent
3d47d6d8b2 if possible, add path and rssi to channel messages 2026-03-05 11:50:41 -04:00
Florent
b1abb8e4d3 extract some info from log_rx 2026-03-05 09:32:19 -04:00
Florent
3716ebf77e handle multibytes in path discovery 2026-02-27 08:59:17 -04:00
Florent
f2def83f30 fix path len issue when getting contacts 2026-02-27 08:33:27 -04:00
Florent
ee75ed12dd add get_path_hash_mode 2026-02-27 07:01:20 -04:00
Florent
dd6d6350d9 multibyte trace support 2026-02-26 22:51:52 -04:00
Florent
32907bb5c1 handle path_hash_size in change_path 2026-02-26 16:48:23 -04:00
Florent
26730d1efa support path_hash_mode 2026-02-26 14:24:02 -04:00
fdlamotte
2c259b9743
Merge pull request #60 from agessaman/fix-sync-callbacks
Fix: Sync callbacks called inline in `_process_events` to eliminate `no_event_received` race
2026-02-21 07:30:25 -04:00
agessaman
a9f68c2971 modify event callback handling to call synchronous callbacks inline, ensuring futures are resolved before waiting. This prevents race conditions when scheduling callbacks asynchronously. 2026-02-19 19:31:56 -08:00
Florent
3f56190423 Revert PR 45 2026-02-18 06:50:44 -04:00
Florent
e51838177f fix lpp values for voltage and current as signed 2026-02-17 08:52:56 -04:00
Florent
6254440a2f disconnect as soon as we have no response to appstart 2026-02-16 14:09:14 -04:00
Florent
8c33c09ac1 handle repeat mode 2026-02-14 15:36:17 -04:00
Florent
d254c8e6ff update timeout 2026-02-14 14:34:01 -04:00
Florent
9100a979dc some packet types were commands vim packets.py ! 2026-02-14 09:50:36 -04:00
Florent
03a2a7c64e get/set repeat mode 2026-02-14 09:39:07 -04:00