Commit Graph

68 Commits

Author SHA1 Message Date
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
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
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
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
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
Florent
3f56190423 Revert PR 45 2026-02-18 06:50:44 -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
pe1hvh
8b3149cb7e fix: subscribe before send to prevent event race condition 2026-02-09 22:53:27 +01:00
Florent
b11a54eaf9 use contact path for anon requests, defaults to 0 hop 2026-02-03 15:19:21 -04:00
Florent
ce6d14d618 disambiguate between anon and binary 2026-02-02 17:04:42 -04:00
Florent
d57162375a autoadd_config 2026-02-02 13:18:44 -04:00
Florent
3b46986dfa implemented anon binary requests 2026-02-02 11:55:18 -04:00
Florent
ac82eeb905 hashtag is not mandatory anymore in scope names 2026-02-01 09:25:44 -04:00
Michiel Appelman
0283003b04 Adds support for pull-based advert requests and responses. 2026-01-11 21:44:03 +01:00
jkingsman
1ea32885a3 Add typing to send_chan_message with test 2025-12-23 18:40:59 -08:00
agessaman
45c265f9c9 Update BLE signing example to use a default chunk size of 120 bytes and add signature verification with the device's public key. Enhance debug output for data length and signature verification results. 2025-12-15 21:29:12 -08:00
agessaman
1ecc1d8055 Add timeout argument to sign and sign_finish methods for improved BLE operation handling 2025-12-15 19:54:44 -08:00
agessaman
c42c30c25d implement device signing binary frames and sign() command for on-device signing. 2025-12-14 22:23:33 -08:00
Florent
6579efe6b4 import_private_key 2025-12-07 17:41:37 +01:00
fdlamotte
3220c4196d Merge pull request #34 from agessaman/main
Companion Nodes Stats
2025-11-24 10:38:04 +01:00
Florent de Lamotte
5571fef670 try to get a 32 bytes key in send_msg_with_retry 2025-11-20 08:15:07 +01:00
Florent
1de435e46d fix issue with reset_path when sending to an hex prefix 2025-11-19 08:57:00 +01:00
Florent de Lamotte
6b24bb7c7f check key size in _validate_destination 2025-11-18 11:27:59 +01:00
agessaman
4a97dd0968 Modify statistics handling in MessageReader to support binary parsing for core, radio, and packet stats. Update DeviceCommands to send appropriate commands for each stats type. 2025-11-17 09:59:50 -08:00
Florent
2ccc121bd8 byteorder is now mandatory in to_bytes vim pyproject.toml ! 2025-11-15 18:27:23 +01:00
Florent
307e517f5e req_neighbours 2025-11-09 16:51:54 +01:00
agessaman
f82ed89c02 Add support for new statistics event types and commands 2025-11-07 22:44:43 -08:00
Florent de Lamotte
a61616297e support only_prefix flag on discover node 2025-11-07 12:59:16 +01:00
Florent
d3c9c8d984 control codes support: node_discover_req 2025-11-07 09:59:40 +01:00
Florent de Lamotte
057051c8c3 take into account * scope 2025-11-06 11:56:22 +01:00
Florent de Lamotte
5a5f97322d Initial support for transport codes : set_flood_scope 2025-11-05 16:32:08 +01:00
Florent de Lamotte
9b6c799d04 mutli_ack -> multi_acks 2025-10-30 11:08:20 +01:00
Florent de Lamotte
3ad3be82e7 support multiple_acks 2025-10-30 10:59:08 +01:00