- 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
Converted log calls across src/, examples/, and test/ to use DEBUGF/TRACEF/ERRORF/etc. macros instead of std::string + operator+. This eliminates temporary heap allocations on every log call, which matters on memory-constrained MCUs.
- Add cull_announce_table() with OOM-safe min_element fallback, matching pattern from cull_path_table() and cull_known_destinations()
- Call cull immediately after every announce/path/known-destination insert
- Fix use-after-free: guard announce_entry access with announce_erased flag
- remove_path() now also deletes cached packet files
- Path table insert now removes existing entry first to prevent duplicates
- Rename env:mcu -> env:embedded; add env:native_debug and heltec_wifi_lora_32_V4
- Make TLSF buffer size configurable via RNS_TLSF_BUFFER_SIZE macro
- Refactor log macros to unified RNS::log() path; add doHeadLog with callback support
- Prefix all bad_alloc error messages with "bad_alloc -" for easier grepping
- Transport::inbound(): pre-emptive cull before destination-table insert;
try/catch around insert for explicit OOM diagnostics
- Transport::jobs(): split stale-entry culling into 5 independent
per-phase try/catch blocks so a failure in one phase doesn't abort
the others; reserve() before push_back loops in each phase
- cull_path_table()/cull_known_destinations(): std::min_element fallback
when sort-index allocation fails, breaking the cull-OOM-still-full loop
- Identity::remember(): wrapped _known_destinations.insert in try/catch
for explicit OOM diagnostic logging
- Destination::announce(): outer try/catch covers all OOM-prone ops
(Bytes concat, sign, Packet ctor, send); inner _path_responses.insert
catch preserved for degraded-mode behavior
- Packet::unpack(): dedicated std::bad_alloc catch returns false cleanly
- Type.h: MAX_RECEIPTS and MAX_QUEUED_ANNOUNCES now overridable at
compile time via RNS_RECEIPTS_MAX / RNS_QUEUED_ANNOUNCES_MAX
- Transport.h: hashlist_maxsize and max_pr_tags exposed as runtime
accessors for dynamic capacity tuning
Fix for link validation failure when poackets contain new MTU in payload
from RNS 1.0 (courtesy of @jlpoolen).
Optimization of announce re-broadcasts from RNS 1.0.
Added support for new `context_flag` in RNS packet header that is used
to indicate the use of ratchets.
Note that ratchet support is still missing from the implementation, but
this fix enables received ratchets to be able to handled gracefully.
Tests for Bytes::assignHex, appendHex, mid() edge cases, and
Transport receipt culling logic. 18 test cases covering the bugs
fixed in the previous commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bytes::assignHex/appendHex: truncate to even length before parsing
to prevent reading past buffer on odd-length hex strings
- Bytes::mid(): fix off-by-one in bounds check (>= vs >)
- Transport: fix receipt culling loop iterating wrong list, which
caused stale receipts to accumulate instead of being removed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>