fix missing relay issue

This commit is contained in:
John Smith 2023-07-02 19:55:21 -05:00
parent b5906a52bc
commit c16888e214
2 changed files with 38 additions and 4 deletions

View File

@ -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)
}

View File

@ -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);