- Announce timestamps now use Unix epoch (time()) instead of OS::time()
which returned uptime on Arduino. Python Transport compares announce
emission timestamps for freshness — uptime-based values caused
re-announces to be rejected by nodes with cached epoch timestamps.
- Remove blocking while(_jobs_running) waits in Transport::outbound()
and Transport::inbound(). On single-threaded ESP32, these deadlock
when outbound() is called from within jobs() (e.g. link proof retry).
- Fix missing _jobs_locked=false on early returns in Transport::inbound()
which would permanently lock the transport after unpack failures,
cache requests, or announce rate limiting.
- Link packets now inherit attached_interface from the Link object via
the Packet(Link,...) constructor. This ensures TCP link traffic stays
on TCP and LoRa link traffic stays on LoRa — critical for devices
with multiple interfaces.
- Implement Link::attached_interface() const getter (was declared but
missing implementation).
- Only apply collision-avoidance delay in Link::prove() for non-TCP
interfaces where half-duplex radio collisions are a real concern.
Link proof was signing with ephemeral Ed25519 key instead of destination
identity key, causing Python clients to reject the proof. Add proof retry
with exponential backoff for LoRa packet loss recovery.
- Fix MTU clamp to zero when previous-hop interface has no HW_MTU (PR #32)
- Send immediate PATH_RESPONSE for local client path requests (PR #33)
- Fix LinkEntry copy-vs-reference: active links were culled after 15 min (PR #34)
- Defer packet hashlist insertion for link-table and LRPROOF packets (PR #35)
- Fix memory leaks in _pending_local_path_requests and _path_requests (PR #36)
- Add constexpr to pool_info constructor to prevent zero-size init race
Note: GPS time display needs further investigation — not showing on device
after flash, likely unrelated to these changes (fresh NVS has no stored epoch).
Skip Ed25519 signature verification for already-known identities in
validate_announce() — uses hash table lookup instead of ~150ms crypto.
On a busy hub with 50+ nodes, this eliminates 90%+ of CPU-blocking
verify work.
Add transport-layer rate limit (5 new verifies/sec) before crypto to
cap worst-case CPU usage for unknown identities.
Defer cull_known_destinations() and cull_announce_table() to periodic
jobs() instead of running O(n log n) sorts per inbound packet.
Vendor libbzip2 (1.0.8, BSD license) for ESP32-compatible bz2
compression/decompression. This matches Python's bz2.compress()
and Rust's bzip2 crate for cross-platform Resource transfers.
C++ wrapper (Compression/BZ2.h):
- bz2_compress() — compress with blockSize100k=9
- bz2_decompress() — decompress with progressive buffer sizing
- try_compress() — compress only if smaller than original
Resource integration:
- OutboundResource::init() now compresses with bz2 if beneficial
- InboundResource::assemble() decompresses if compressed flag set
- ResourceFlags.compressed bit tracks compression state
3 new tests (test_resource_transfer):
- testBz2CompressDecompress — roundtrip verification
- testTryCompress — beneficial vs non-beneficial compression
- testBz2CrossPlatformFormat — BZh magic bytes match Python/Rust
Total: 137 tests, 136 pass (1 pre-existing allocator).
Moves the LXMF message packing/unpacking/signing code from Ratdeck
into microReticulum as a shared library module. This enables:
- Native platform LXMF tests (pio test -e native17)
- Cross-implementation fixture validation
- Single source of truth for C++ LXMF wire format
The codec is adapted from Ratdeck's LXMFMessage.h/cpp with Arduino.h
dependency removed (replaced with cstdint for native platform support).
Wire format matches Python LXMF (LXMessage.py) and Rust (lxmf-core):
- Opportunistic: [src:16][sig:64][msgpack(ts, title, content, fields)]
- Direct: [dest:16][src:16][sig:64][msgpack(ts, title, content, fields)]
- Title/content encoded as MsgPack bin (0xC4/0xC5), not str
Note: Ratdeck will be updated to #include <LXMFMessage.h> from the
library (removing its local copy) after this change is pushed.
Identity.cpp: OS::time() on Arduino returns seconds since boot, not epoch.
Persisted known_destinations entries carried timestamps from the previous
session (e.g., 5000s). On a fresh boot at 31s uptime, new announces got
timestamp 31.0 — the LRU cull saw this as "oldest" and removed it
immediately. Identity::recall() could never find the destination, breaking
all outbound LXMF messaging. Fix: normalize loaded timestamps to [1, now-1]
preserving relative order, so fresh announces are always newest.
Transport.cpp: Revert b44d374's endpoint caching skip — Ratdeck runs as
endpoint and needs cached announces for path table persistence across
reboots. Restore immediate cull behavior. Add DIAG-PROOF logging for
tracing link proof broadcast routing across interfaces.
- Guard announce cache_packet(force=true) with transport_enabled() so
endpoints skip 300-900ms flash writes per announce
- Defer cull_path_table/cull_announce_table until 10% over capacity
instead of after every insert
- Rewrite clean_caches: endpoints just wipe stale files in one pass;
transport nodes use std::set for O(N+M) instead of O(N*M) lookups
- get_path(): Remove announce_packet null check that destroyed valid path
entries when cache deserialization failed under heap pressure. Routing
fields (_received_from, _hops, receiving_interface) are valid without it.
- hops_to(): Direct path table lookup instead of get_path() to avoid
triggering expensive announce_packet lazy load from flash cache.
- path_request_handler(): Guard against null announce_packet gracefully.
- Persistence: Add PSRAM allocator for ArduinoJson JsonDocument on ESP32
boards with PSRAM, preventing deserialization failures when heap is low.
The >= 1 change made the hops==1 branch (hub topology) convert
packets to Header2 with potentially wrong transport_id before
send_outgoing() could apply the correct learned hub transport_id.
Reverting to > 1 matches the original Python logic and lets
hops==1 packets fall through as Header1 for proper wrapping.
std::map::insert() is a no-op for existing keys, so identities loaded
from persisted known_destinations kept their old timestamps. When
cull_known_destinations() ran after insert, it removed the "stale"
entry that was just validated — causing Identity::recall() to fail
and hexhash() to assert on a null identity.
Fix: use insert_or_assign() to always refresh the timestamp.
Also reverts the dead-code needs_transport_headers() virtual method
(the else-if at Transport.cpp:826 is unreachable because hops>=1
already catches hops==1 in the preceding if block).
TCP interfaces behind a hub need HEADER_2 transport wrapping even at
hops==1, since the hub can't forward raw HEADER_1 packets. Added virtual
needs_transport_headers() to InterfaceImpl (defaults to false) so TCP
subclasses can override it without setting is_connected_to_shared_instance
(which would brick the device by skipping all Reticulum::loop processing).
Introduces a flexible two-class allocator architecture (RNS_DEFAULT_ALLOCATOR and RNS_CONTAINER_ALLOCATOR) supporting heap, PSRAM, and TLSF pool variants for fine-grained control over embedded memory layout.
New Memory.h/cpp with ContainerAllocator, heap/PSRAM/pool allocator types, and heap stats reporting
IdentityTable and PathTable now use ContainerAllocator
Replaced RNS_USE_TLSF/RNS_USE_ALLOCATOR/RNS_USE_PSRAM flags with per-class allocator flags (RNS_DEFAULT_ALLOCATOR, RNS_CONTAINER_ALLOCATOR)
Added ESP32 PSRAM allocator support (RNS_PSRAM_ALLOCATOR, RNS_PSRAM_POOL_ALLOCATOR)
Added Transport::get_path()/remove_path() helpers
Added loop callback (set_loop_callback) to enable more responsive app during long operations (like clean_cache)
Aded guard against re-entrancy to clean_cache()
Added callback option to list_directory() to avoid heap allocation
Added OOM auto-restart (ESP.restart/NVIC_SystemReset) in Interface send/receive and Reticulum loop.
Renamed setLogCallback to set_log_callback
Made Link/Identity static members private
Added native14 env to CI and platformio.ini
Bumped version to 0.2.10
Introduces a flexible two-class allocator architecture (RNS_DEFAULT_ALLOCATOR and RNS_CONTAINER_ALLOCATOR) supporting heap, PSRAM, and TLSF pool variants for fine-grained control over embedded memory layout.
- New Memory.h/cpp with ContainerAllocator<T>, heap/PSRAM/pool allocator types, and heap stats reporting
- IdentityTable and PathTable now use ContainerAllocator
- Replaced RNS_USE_TLSF/RNS_USE_ALLOCATOR/RNS_USE_PSRAM flags with per-class allocator flags (RNS_DEFAULT_ALLOCATOR, RNS_CONTAINER_ALLOCATOR)
- Added ESP32 PSRAM allocator support (RNS_PSRAM_ALLOCATOR, RNS_PSRAM_POOL_ALLOCATOR)
- Added Transport::get_path()/remove_path() helpers
- Added loop callback (set_loop_callback) to enable more responsive app during long operations (like clean_cache)
- Aded guard against re-entrancy to clean_cache()
- Added callback option to list_directory() to avoid heap allocation
- Added OOM auto-restart (ESP.restart/NVIC_SystemReset) in Interface send/receive and Reticulum loop.
- Renamed setLogCallback to set_log_callback
- Made Link/Identity static members private
- Added native14 env to CI and platformio.ini
- Bumped version to 0.2.10
- Fixed bug in path table loading from flash storage wherein the raw
(packed) announce packet associated with each path entry was not being
unpacked prior to use.
- Fixed bug in path table entry announce packet loading where critical
changes to the announce packet (like hops increment) was being
overwriteen each time packet was re-loaded from cache.
- Optimized path table entries to lazy-load both announce packet and
receive interface so that memory is consumed by these structures until
if/when the path is actually used.
- Updated several global timers and sizes to match new RNS 1.x values.
- Bumped version to 0.2.9