mirror of
https://github.com/ratspeak/rsReticulum
synced 2026-11-27 13:52:16 +00:00
transport: honor unfiltered announce deregistration
This commit is contained in:
1 parent
2bf531180e
commit
dfe42f2194
1 file changed
+24
-1
@@ -554,7 +554,7 @@ impl TransportActor {
|
||||
if let Some(ref target) = aspect_filter {
|
||||
registration.aspect_filter.as_ref() != Some(target)
|
||||
} else {
|
||||
true
|
||||
false
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1865,6 +1865,29 @@ mod tests {
|
||||
assert!(!actor.local_destinations.contains(&hash));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deregister_announce_handler_without_filter_removes_all() {
|
||||
let (mut actor, _tx) = TransportActor::new();
|
||||
let (first_tx, _first_rx) = mpsc::channel(1);
|
||||
let (second_tx, _second_rx) = mpsc::channel(1);
|
||||
actor.handle_message(TransportMessage::RegisterAnnounceHandler {
|
||||
aspect_filter: Some("first.aspect".into()),
|
||||
receive_path_responses: false,
|
||||
callback_tx: first_tx,
|
||||
});
|
||||
actor.handle_message(TransportMessage::RegisterAnnounceHandler {
|
||||
aspect_filter: None,
|
||||
receive_path_responses: true,
|
||||
callback_tx: second_tx,
|
||||
});
|
||||
assert_eq!(actor.announce_handlers.len(), 2);
|
||||
|
||||
actor.handle_message(TransportMessage::DeregisterAnnounceHandler {
|
||||
aspect_filter: None,
|
||||
});
|
||||
assert!(actor.announce_handlers.is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_actor_shutdown() {
|
||||
let (actor, tx) = TransportActor::new();
|
||||
|
||||
Reference in new issue
Block a user