mirror of
https://github.com/ratspeak/rsReticulum
synced 2026-11-27 13:52:16 +00:00
transport: count a path request only once its tag passes the duplicate check
This commit is contained in:
1 parent
4683cb2c2a
commit
e16c8b4d39
4 files changed
+32
-9
No files matched your search
@@ -25,6 +25,7 @@
|
||||
- Interface discovery announces name this stack, `rsRNS`, and its version. `rnsd-rs` auto-connects only to Backbone interfaces announced by Python Reticulum 1.5.2 or later, or to any announced Backbone interface with `autoconnect_unverified_implementations`, and no longer stores or lists discovered TCP client interfaces, as in Python Reticulum.
|
||||
- Discovery announces a KISS-framed TCP client as a KISS interface and sends and reads unset radio parameters as nil, so Python and `rnsd-rs` read each other's KISS, Weave and RNode announces, as in Python Reticulum.
|
||||
- `rns_link::clock::ContinuousInstant` reads a monotonic clock that keeps counting while the system is suspended, for deadlines that must hold in real time across a sleep.
|
||||
- An interface counts a path request in its stats only once its tag passes the duplicate check, as in Python Reticulum 1.5.
|
||||
|
||||
## 1.4.0 - 2026-10-12
|
||||
|
||||
|
||||
@@ -11001,8 +11001,10 @@ mod tests {
|
||||
assert_eq!(actor.discovery_pr_tags.len(), 3);
|
||||
}
|
||||
|
||||
/// Python 1.5 counts a path request only once its tag passes the
|
||||
/// duplicate gate (Transport.py:1847-1858), where 1.4 counted every one.
|
||||
#[test]
|
||||
fn duplicate_path_requests_still_count_toward_ingress_frequency() {
|
||||
fn duplicate_path_requests_do_not_count_toward_ingress_frequency() {
|
||||
let (mut actor, _tx) = TransportActor::new();
|
||||
actor.is_transport_enabled = true;
|
||||
|
||||
@@ -11024,15 +11026,15 @@ mod tests {
|
||||
actor.handle_inbound_path_request(&payload, 1);
|
||||
|
||||
assert!(boundary_rx.try_recv().is_err());
|
||||
assert!(
|
||||
assert_eq!(
|
||||
actor
|
||||
.interfaces
|
||||
.get(&1)
|
||||
.unwrap()
|
||||
.ingress
|
||||
.incoming_pr_frequency()
|
||||
> 0.0,
|
||||
"duplicate tagged PRs must still contribute to ingress PR stats"
|
||||
.path_requests_received(),
|
||||
1,
|
||||
"duplicate tagged PRs neither forward nor count"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -606,10 +606,6 @@ impl TransportActor {
|
||||
self.protocol_violation(interface_id);
|
||||
}
|
||||
|
||||
if let Some(entry) = self.interfaces.get_mut(&interface_id) {
|
||||
entry.ingress.received_path_request();
|
||||
}
|
||||
|
||||
let now = now_f64();
|
||||
let mut unique_tag = Vec::with_capacity(32);
|
||||
unique_tag.extend_from_slice(&requested_dest);
|
||||
@@ -621,6 +617,11 @@ impl TransportActor {
|
||||
return;
|
||||
}
|
||||
self.discovery_pr_tags.insert(unique_tag, now);
|
||||
// Python counts a path request once its tag passes this gate
|
||||
// (Transport.py:1847-1858).
|
||||
if let Some(entry) = self.interfaces.get_mut(&interface_id) {
|
||||
entry.ingress.received_path_request();
|
||||
}
|
||||
|
||||
if self.local_destinations.contains(&requested_dest) {
|
||||
debug!(
|
||||
|
||||
@@ -304,6 +304,25 @@ fn a_full_transmit_queue_counts_dropped_bytes() {
|
||||
assert_eq!(entry.tx_dropped_bytes, 50, "txdrb");
|
||||
}
|
||||
|
||||
/// Python counts a path request once its destination and tag pass the
|
||||
/// duplicate gate (Transport.py:1847-1858), so a repeat sent through another
|
||||
/// requestor neither counts nor brings the ingress limit closer.
|
||||
#[test]
|
||||
fn a_repeated_path_request_tag_is_not_counted() {
|
||||
let mut actor = hub();
|
||||
let _rx = attach(&mut actor, 1);
|
||||
let request = |requestor: u8| {
|
||||
let mut rest = vec![requestor; 16];
|
||||
rest.extend_from_slice(&[0xA1; 16]);
|
||||
path_request([0x51; 16], &rest)
|
||||
};
|
||||
|
||||
inbound(&mut actor, request(0xC1), 1);
|
||||
inbound(&mut actor, request(0xC2), 1);
|
||||
|
||||
assert_eq!(stats(&mut actor, 1).path_requests_received, 1, "prxc");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_accepted_client_names_its_listener() {
|
||||
let mut actor = hub();
|
||||
|
||||
Reference in new issue
Block a user