crash fixes

This commit is contained in:
John Smith 2022-05-28 11:44:09 -04:00
parent b6e568f664
commit 3c5274cddd
3 changed files with 24 additions and 2 deletions

View File

@ -56,11 +56,25 @@ impl DiscoveryContext {
// Pick the best network class we have seen so far
pub fn set_detected_network_class(&self, network_class: NetworkClass) {
let mut inner = self.inner.lock();
log_net!( debug
"=== set_detected_network_class {:?} {:?}: {:?} ===",
inner.protocol_type,
inner.address_type,
network_class
);
inner.detected_network_class = Some(network_class);
}
pub fn set_detected_public_dial_info(&self, dial_info: DialInfo, class: DialInfoClass) {
let mut inner = self.inner.lock();
log_net!( debug
"=== set_detected_public_dial_info {:?} {:?}: {} {:?} ===",
inner.protocol_type,
inner.address_type,
dial_info,
class
);
inner.detected_public_dial_info = Some(DetectedPublicDialInfo { dial_info, class });
}
@ -353,6 +367,11 @@ impl Network {
// Loop for restricted NAT retries
loop {
log_net!(debug
"=== update_ipv4_protocol_dialinfo {:?} tries_left={} ===",
protocol_type,
retry_count
);
// Get our external address from some fast node, call it node 1
if !context.protocol_get_external_address_1().await {
// If we couldn't get an external address, then we should just try the whole network class detection again later
@ -402,6 +421,8 @@ impl Network {
// Start doing ipv6 protocol
context.protocol_begin(protocol_type, AddressType::IPV6);
log_net!(debug "=== update_ipv6_protocol_dialinfo {:?} ===", protocol_type);
// Get our external address from some fast node, call it node 1
if !context.protocol_get_external_address_1().await {
// If we couldn't get an external address, then we should just try the whole network class detection again later

View File

@ -291,6 +291,7 @@ impl NetworkManager {
{
let mut inner = self.inner.lock();
inner.components = None;
inner.relay_node = None;
}
// send update

View File

@ -91,11 +91,11 @@ core:
set_value_fanout: 5
min_peer_count: 1 # 20
min_peer_refresh_time_ms: 2000
validate_dial_info_receipt_time_ms: 5000
validate_dial_info_receipt_time_ms: 1000
upnp: false
natpmp: false
enable_local_peer_scope: false
restricted_nat_retries: 3
restricted_nat_retries: 5
tls:
certificate_path: '%CERTIFICATE_DIRECTORY%/server.crt'
private_key_path: '%PRIVATE_KEY_DIRECTORY%/server.key'