fix firewalling/fragmentation issue

This commit is contained in:
John Smith 2023-06-10 11:02:48 -04:00
parent 88466db03f
commit b6c39ef042
2 changed files with 18 additions and 1 deletions

View File

@ -1077,8 +1077,17 @@ impl NetworkManager {
// Dial info filter comes from the target node ref
let dial_info_filter = target_node_ref.dial_info_filter();
let sequencing = target_node_ref.sequencing();
let mut sequencing = target_node_ref.sequencing();
// If the node has had lost questions or failures to send, prefer sequencing
// to improve reliability. The node may be experiencing UDP fragmentation drops
// or other firewalling issues and may perform better with TCP.
let unreliable = target_node_ref.peer_stats().rpc_stats.failed_to_send > 0 || target_node_ref.peer_stats().rpc_stats.recent_lost_answers > 0;
if unreliable && sequencing < Sequencing::PreferOrdered {
sequencing = Sequencing::PreferOrdered;
}
// Get the best contact method with these parameters from the routing domain
let cm = routing_table.get_contact_method(
routing_domain,
&peer_a,

View File

@ -844,6 +844,10 @@ impl RPCProcessor {
// Record for node if this was not sent via a route
if safety_route.is_none() && remote_private_route.is_none() {
node_ref.stats_failed_to_send(send_ts, wants_answer);
// Also clear the last_connections for the entry so we make a new connection next time
node_ref.clear_last_connections();
return;
}
@ -872,6 +876,10 @@ impl RPCProcessor {
// Record for node if this was not sent via a route
if safety_route.is_none() && remote_private_route.is_none() {
node_ref.stats_question_lost();
// Also clear the last_connections for the entry so we make a new connection next time
node_ref.clear_last_connections();
return;
}
// Get route spec store