Commit Graph

626 Commits

Author SHA1 Message Date
Rigear
b3fdfee474 fix: Handle TLS for all MQTT connections 2026-04-24 14:30:44 -07:00
Rigear
3a6da407be fix: Always parse additional brokers 2026-04-24 14:30:05 -07:00
Rigear
53f6e8af4f fix: Remove old letsmesh_handler.py file 2026-04-24 14:19:31 -07:00
Lloyd
71595c9226 Update pymc_core dependency to version 1.0.10 and correct installation messages to reflect PyPI source 1.0.9 2026-04-24 16:13:17 +01:00
Lloyd
fd7ead3697 Merge pull request #202 from rightup/fix-perfom-speed
Fix perfom speed
2026-04-24 16:03:33 +01:00
Lloyd
e0dd91b91e Skip inbound trace processing for locally injected TRACE packets 2026-04-24 10:04:01 +01:00
Lloyd
6b406a5019 Remove unused imports and simplify send_packet retry logic in TX lock tests 2026-04-24 09:02:07 +01:00
Lloyd
b949bdeab8 Merge pull request #190 from tjdownes/fix/tx-serialization
fix: serialise radio TX and close duty-cycle TOCTOU race
2026-04-24 08:59:56 +01:00
Lloyd
498303a673 Merge pull request #201 from yellowcooln/fix-perfom-speed
Introduce Buildroot/Luckfox support via buildroot-manage.sh and init.d service handling
2026-04-24 08:46:09 +01:00
Yellowcooln
4783b56981 Derive Buildroot core ref from repo branch 2026-04-23 23:21:15 -04:00
Yellowcooln
15b683ba11 Remove debug from Buildroot manager 2026-04-23 22:06:33 -04:00
Yellowcooln
5ed6c0ef90 Use board tx power for Buildroot profiles 2026-04-23 22:00:14 -04:00
Yellowcooln
c000894f8a Reject default setup values on Buildroot 2026-04-23 21:47:13 -04:00
Yellowcooln
b1a5621a0a Revert "Honor seeded Buildroot setup config"
This reverts commit aba0f5bd09.
2026-04-23 21:46:13 -04:00
Yellowcooln
aba0f5bd09 Honor seeded Buildroot setup config 2026-04-23 21:44:06 -04:00
Yellowcooln
3208018c6d Clean stale Buildroot install paths 2026-04-23 20:32:09 -04:00
Yellowcooln
25e55bdca8 Merge remote-tracking branch 'origin/dev' into buildroot 2026-04-23 20:28:19 -04:00
Yellowcooln
d22ba91f19 Apply Buildroot preset values directly 2026-04-23 16:11:44 -04:00
Yellowcooln
91025e4970 Use raw tty for Buildroot password prompt 2026-04-23 16:09:09 -04:00
Yellowcooln
74f5963a85 Use Buildroot config flow by default 2026-04-23 16:07:32 -04:00
Yellowcooln
9677a39aa8 Make Buildroot password prompt sh-safe 2026-04-23 16:05:31 -04:00
Yellowcooln
ab2c82db16 Drive Buildroot radio config from JSON 2026-04-23 16:01:32 -04:00
Yellowcooln
cc9c81de2a Seed Buildroot config from repo installer 2026-04-23 15:57:21 -04:00
Lloyd
37cd137bbb Merge pull request #191 from tjdownes/perf/in-flight-cap
perf: replace _route_tasks set with bounded in-flight counter
2026-04-23 16:08:41 +01:00
Yellowcooln
e5c7632700 Handle Buildroot service restarts 2026-04-23 11:05:59 -04:00
Yellowcooln
7e541cd1f1 Use image runtime modules on Buildroot 2026-04-23 10:52:52 -04:00
Yellowcooln
f92dd4ab5f Recreate contaminated Buildroot venvs 2026-04-23 10:36:20 -04:00
Yellowcooln
1b3f0490ec Repair Buildroot venv build backend 2026-04-23 10:22:13 -04:00
Yellowcooln
a6818367e8 Fail fast on unusable Buildroot native modules 2026-04-23 09:04:15 -04:00
Yellowcooln
07dc287f50 Keep Buildroot manager sh-compatible 2026-04-23 08:58:58 -04:00
Yellowcooln
0713b571d8 Install Buildroot deps from wheel sources 2026-04-23 08:58:13 -04:00
Yellowcooln
ba2136dfa6 Avoid source builds on Buildroot install 2026-04-23 00:10:50 -04:00
Yellowcooln
95918dc43d Prefer Rightup wheels on Buildroot install 2026-04-23 00:03:57 -04:00
Yellowcooln
bc809c3021 Explain Buildroot install progress 2026-04-23 00:01:03 -04:00
Yellowcooln
e36b477230 Run Buildroot service as root 2026-04-22 23:14:45 -04:00
Yellowcooln
6c0f4fb842 Fix init script generation for BusyBox 2026-04-22 22:35:16 -04:00
Yellowcooln
b58578acd5 Drop yq dependency from Buildroot install flow 2026-04-22 22:31:46 -04:00
Yellowcooln
4d6993c9e1 Allow Buildroot manager to run under sh 2026-04-22 22:30:18 -04:00
Yellowcooln
34fe07d7b0 Split Buildroot flow into dedicated manager 2026-04-22 22:26:18 -04:00
Yellowcooln
7cbaa9115e Add Buildroot support to manage script 2026-04-22 21:48:40 -04:00
Lloyd
852939b701 fix: reorder MQTT error handling. 2026-04-22 14:02:42 +01:00
Lloyd
1626b3f307 feat: add max flood hops configuration to repeater settings 2026-04-22 13:52:40 +01:00
TJ Downes
7d1aa57321 fix(router): drain in-flight tasks on shutdown; add drop counter; add tests
Addresses PR 191 reviewer feedback:

1. Shutdown drain
   stop() now waits up to 5 s for in-flight _route_packet tasks to finish,
   then cancels any that remain.  Previously only the queue-consumer loop was
   cancelled; created tasks were abandoned with no guarantee they completed.

   Mechanism: _route_tasks set tracks live tasks (added on create, discarded
   in the done-callback).  stop() takes a snapshot and calls asyncio.wait()
   with timeout=5.0, then cancels the still-pending subset.

2. Drop counter
   _cap_drop_count increments each time a packet is dropped at the cap.
   The running total is included in every WARNING log line and also printed
   at shutdown so operators can tell at a glance whether the safety valve is
   actually firing in production.

3. Tests (tests/test_packet_router.py)
   test_cap_drops_packets_when_full     — cap=3, send 8 → 5 drops, 3 in-flight
   test_cap_drop_count_increments       — count increments by 1 per drop
   test_cap_drop_count_zero_...         — count stays 0 when cap never reached
   test_stop_waits_for_in_flight_tasks  — slow task (0.2 s) completes, not cancelled
   test_stop_cancels_tasks_...timeout   — hanging task cancelled after timeout
   test_route_tasks_set_cleaned_up      — set empty after all tasks finish
   test_counter_matches_set_size        — _in_flight == len(_route_tasks) at cap

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 05:46:49 -07:00
TJ Downes
179158e68b fix(engine): release _tx_lock during local-TX retry backoff; add lock tests
Reviewer concern (PR 190):
  The 1-second backoff sleep for local_transmission retry happened inside
  `async with self._tx_lock`, blocking all other queued TX tasks for the
  full second — hurting latency and throughput under load.

Fix — tighten lock scope to one attempt per acquisition:
  Before:  acquire lock → [attempt 0 → sleep(1) → attempt 1] → release
  After:   for each attempt:
             [sleep(1) if retry]          ← OUTSIDE the lock
             acquire lock
             re-check can_transmit        ← fresh check every acquisition
             attempt single send
             record_tx on success
             release lock

The duty-cycle gate now runs on every lock acquisition (not just the first),
which is correct: airtime state may change during the backoff sleep.

Tests added (tests/test_tx_lock.py):
  1. test_concurrent_sends_do_not_interleave — two tasks racing to the same
     delay timer must never overlap inside send_packet.
  2. test_duty_cycle_toctou_is_fixed — second packet is dropped when the
     first consumes the budget inside the lock.
  3. test_local_retry_releases_lock_during_backoff — a concurrent relayed
     packet fires at ~0.1s while local retry sleeps 1s; confirms it is not
     blocked by the backoff.
  4. test_non_local_failure_propagates — relayed send failure raises
     immediately with exactly one attempt.
  5. test_duty_cycle_rechecked_on_retry — if the budget is exhausted during
     backoff, the retry is dropped by the in-lock gate (not sent).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 05:29:47 -07:00
Lloyd
827b9a9f98 fix: improve logging for MQTT error decoding to reduce noise 2026-04-22 13:28:23 +01:00
Lloyd
9eae6ed872 Merge pull request #193 from tjdownes/perf/sqlite-wal-threadlocal
perf: thread-local SQLite connections, synchronous=NORMAL, dedup indexes
2026-04-22 11:00:50 +01:00
Lloyd
986e22de1f Merge pull request #195 from tjdownes/perf/advert-deque
This is a solid, well-analyzed optimization, thank you
2026-04-22 10:45:46 +01:00
Lloyd
af79eaf63f Merge pull request #192 from tjdownes/perf/hash-once
perf: compute packet hash once per packet in the forwarding hot path
2026-04-22 10:38:04 +01:00
Lloyd
5c947e6c2e feat: enhance WebSocket handling and add throttling for stats broadcasting 2026-04-22 09:48:27 +01:00
Lloyd
40ec2ba293 Merge pull request #194 from tjdownes/perf/debug-log-guards
Merged this now. It’s a safe change with no behavioural impact, and it removes unnecessary work in the hot paths when DEBUG logging is off. Happy to revisit if we want to standardise on lazy formatting later, but this gives us an immediate win.
2026-04-22 09:45:55 +01:00