diff --git a/veilid-core/src/network_manager/send_data.rs b/veilid-core/src/network_manager/send_data.rs index 9a8ea1e1..59ae1c7e 100644 --- a/veilid-core/src/network_manager/send_data.rs +++ b/veilid-core/src/network_manager/send_data.rs @@ -39,14 +39,23 @@ impl NetworkManager { // Try the contact method let sdk = match contact_method { - NodeContactMethod::OutboundRelay(relay_nr) + NodeContactMethod::OutboundRelay(relay_nr) => { + // Relay loop or multiple relays + bail!( + "Outbound relay loop or multiple relays detected: destination {} resolved to target {} via extraneous relay {}", + destination_node_ref, + target_node_ref, + relay_nr, + ); + + } | NodeContactMethod::InboundRelay(relay_nr) => { // Relay loop or multiple relays bail!( - "Relay loop or multiple relays detected: destination {} resolved to target {} via extraneous relay {}", + "Inbound relay loop or multiple relays detected: destination {} resolved to target {} via extraneous relay {}", destination_node_ref, target_node_ref, - relay_nr + relay_nr, ); } NodeContactMethod::Direct(dial_info) => { diff --git a/veilid-core/src/routing_table/routing_domains.rs b/veilid-core/src/routing_table/routing_domains.rs index b1d0b97a..04a9a2cf 100644 --- a/veilid-core/src/routing_table/routing_domains.rs +++ b/veilid-core/src/routing_table/routing_domains.rs @@ -422,7 +422,10 @@ impl RoutingDomainDetail for PublicInternetRoutingDomainDetail { // If node A can't reach the node by other means, it may need to use its own relay if let Some(node_a_relay_id) = peer_a.signed_node_info().relay_ids().get(best_ck) { - return ContactMethod::OutboundRelay(node_a_relay_id); + // Ensure it's not our relay we're trying to reach + if node_a_relay_id != node_b_id { + return ContactMethod::OutboundRelay(node_a_relay_id); + } } ContactMethod::Unreachable