mirror of
https://github.com/ratspeak/rsReticulum
synced 2026-11-27 13:52:16 +00:00
transport: use path response on shared registration
This commit is contained in:
1 parent
9eed85392e
commit
d406d76b35
1 file changed
+30
-1
@@ -467,7 +467,12 @@ impl TransportActor {
|
||||
if self.is_shared_instance {
|
||||
if let Err(e) =
|
||||
tx.try_send(crate::link_messages::DestinationEvent::AnnounceRequested(
|
||||
crate::link_messages::AnnounceRequest::normal(app_name.clone()),
|
||||
crate::link_messages::AnnounceRequest {
|
||||
app_name: app_name.clone(),
|
||||
path_response: true,
|
||||
tag: None,
|
||||
attached_interface: None,
|
||||
},
|
||||
))
|
||||
{
|
||||
self.channel_drops += 1;
|
||||
@@ -1893,6 +1898,30 @@ mod tests {
|
||||
assert!(actor.local_destinations.contains(&hash));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shared_instance_registration_requests_path_response_announce() {
|
||||
let (mut actor, _tx) = TransportActor::new();
|
||||
actor.is_shared_instance = true;
|
||||
let hash = [0xAB; 16];
|
||||
let (delivery_tx, mut delivery_rx) = mpsc::channel(1);
|
||||
|
||||
actor.handle_message(TransportMessage::RegisterDestination {
|
||||
hash,
|
||||
app_name: "test.shared".to_string(),
|
||||
delivery_tx: Some(delivery_tx),
|
||||
});
|
||||
|
||||
let crate::link_messages::DestinationEvent::AnnounceRequested(request) =
|
||||
delivery_rx.try_recv().unwrap()
|
||||
else {
|
||||
panic!("expected announce request");
|
||||
};
|
||||
assert_eq!(request.app_name, "test.shared");
|
||||
assert!(request.path_response);
|
||||
assert!(request.tag.is_none());
|
||||
assert!(request.attached_interface.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deregister_destination() {
|
||||
let (mut actor, _tx) = TransportActor::new();
|
||||
|
||||
Reference in new issue
Block a user