feat(fapp): add FappRouter for mesh integration
New fapp_router.rs module: - FappAction enum (Ignore, Dropped, Forward, QueryResponse) - Wire format: 1-byte tag (0x01-0x05) + CBOR body - FappRouter with shared RoutingTable and TransportManager - handle_incoming() decodes and dispatches FAPP frames - process_slot_announce() with relay/flood logic - process_slot_query() answers from local FappStore - broadcast_announce() / send_query() for outbound floods - drain_pending_sends() for async send integration - 3 unit tests Also fixed borrow checker issue in FappStore::store
This commit is contained in:
@@ -426,14 +426,14 @@ impl FappStore {
|
||||
}
|
||||
}
|
||||
|
||||
// Capacity check per therapist.
|
||||
let queue = self
|
||||
.announces
|
||||
.entry(announce.therapist_address)
|
||||
.or_default();
|
||||
if queue.len() >= MAX_PER_THERAPIST {
|
||||
// Evict oldest.
|
||||
queue.remove(0);
|
||||
let addr = announce.therapist_address;
|
||||
|
||||
// Capacity check per therapist (evict oldest if needed).
|
||||
{
|
||||
let queue = self.announces.entry(addr).or_default();
|
||||
if queue.len() >= MAX_PER_THERAPIST {
|
||||
queue.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Total capacity check.
|
||||
@@ -452,10 +452,9 @@ impl FappStore {
|
||||
}
|
||||
|
||||
// Update latest sequence.
|
||||
self.latest_sequence
|
||||
.insert(announce.therapist_address, announce.sequence);
|
||||
self.latest_sequence.insert(addr, announce.sequence);
|
||||
|
||||
queue.push(announce);
|
||||
self.announces.entry(addr).or_default().push(announce);
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user