From c16888e2149ee781ba01d1fa6268effd2771aa8e Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 2 Jul 2023 19:55:21 -0500 Subject: [PATCH] fix missing relay issue --- veilid-core/src/network_manager/send_data.rs | 32 ++++++++++++++++--- .../src/routing_table/routing_table_inner.rs | 10 ++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/veilid-core/src/network_manager/send_data.rs b/veilid-core/src/network_manager/send_data.rs index 8774f5ad..0d8b336e 100644 --- a/veilid-core/src/network_manager/send_data.rs +++ b/veilid-core/src/network_manager/send_data.rs @@ -357,7 +357,13 @@ impl NetworkManager { ContactMethod::SignalReverse(relay_key, target_key) => { let mut relay_nr = routing_table .lookup_and_filter_noderef(relay_key, routing_domain.into(), dial_info_filter)? - .ok_or_else(|| eyre!("couldn't look up relay"))?; + .ok_or_else(|| { + eyre!( + "couldn't look up relay for signal reverse: {} with filter {:?}", + relay_key, + dial_info_filter + ) + })?; if !target_node_ref.node_ids().contains(&target_key) { bail!("signalreverse target noderef didn't match target key: {:?} != {} for relay {}", target_node_ref, target_key, relay_key ); } @@ -367,7 +373,13 @@ impl NetworkManager { ContactMethod::SignalHolePunch(relay_key, target_key) => { let mut relay_nr = routing_table .lookup_and_filter_noderef(relay_key, routing_domain.into(), dial_info_filter)? - .ok_or_else(|| eyre!("couldn't look up relay"))?; + .ok_or_else(|| { + eyre!( + "couldn't look up relay for hole punch: {} with filter {:?}", + relay_key, + dial_info_filter + ) + })?; if !target_node_ref.node_ids().contains(&target_key) { bail!("signalholepunch target noderef didn't match target key: {:?} != {} for relay {}", target_node_ref, target_key, relay_key ); } @@ -383,14 +395,26 @@ impl NetworkManager { ContactMethod::InboundRelay(relay_key) => { let mut relay_nr = routing_table .lookup_and_filter_noderef(relay_key, routing_domain.into(), dial_info_filter)? - .ok_or_else(|| eyre!("couldn't look up relay"))?; + .ok_or_else(|| { + eyre!( + "couldn't look up relay for inbound relay: {} with filter {:?}", + relay_key, + dial_info_filter + ) + })?; relay_nr.set_sequencing(sequencing); NodeContactMethod::InboundRelay(relay_nr) } ContactMethod::OutboundRelay(relay_key) => { let mut relay_nr = routing_table .lookup_and_filter_noderef(relay_key, routing_domain.into(), dial_info_filter)? - .ok_or_else(|| eyre!("couldn't look up relay"))?; + .ok_or_else(|| { + eyre!( + "couldn't look up relay for outbound relay: {} with filter {:?}", + relay_key, + dial_info_filter + ) + })?; relay_nr.set_sequencing(sequencing); NodeContactMethod::OutboundRelay(relay_nr) } diff --git a/veilid-core/src/routing_table/routing_table_inner.rs b/veilid-core/src/routing_table/routing_table_inner.rs index 9924efdc..ef1f5401 100644 --- a/veilid-core/src/routing_table/routing_table_inner.rs +++ b/veilid-core/src/routing_table/routing_table_inner.rs @@ -852,6 +852,16 @@ impl RoutingTableInner { } } + // Register relay info first if we have that + if let Some(relay_peer_info) = peer_info.signed_node_info().relay_peer_info() { + self.register_node_with_peer_info( + outer_self.clone(), + routing_domain, + relay_peer_info, + false, + )?; + } + let (node_ids, signed_node_info) = peer_info.destructure(); let mut nr = self.create_node_ref(outer_self, &node_ids, |_rti, e| { e.update_signed_node_info(routing_domain, signed_node_info);