network fixes

This commit is contained in:
Christien Rioux 2023-07-19 10:07:51 -04:00
parent 0fb49bf715
commit f65400a1ce
16 changed files with 309 additions and 129 deletions

View file

@ -126,19 +126,21 @@ fn main() -> EyreResult<()> {
}
// --- Normal Startup ---
let orig_hook = std::panic::take_hook();
std::panic::set_hook(Box::new(move |panic_info| {
// invoke the default handler and exit the process
orig_hook(panic_info);
let backtrace = backtrace::Backtrace::new();
eprintln!("Backtrace:\n{:?}", backtrace);
eprintln!("exiting!");
std::process::exit(1);
}));
let panic_on_shutdown = matches.occurrences_of("panic") != 0;
ctrlc::set_handler(move || {
if panic_on_shutdown {
let orig_hook = std::panic::take_hook();
std::panic::set_hook(Box::new(move |panic_info| {
// invoke the default handler and exit the process
orig_hook(panic_info);
let backtrace = backtrace::Backtrace::new();
eprintln!("Backtrace:\n{:?}", backtrace);
std::process::exit(1);
}));
panic!("panic requested");
} else {
shutdown();

View file

@ -102,7 +102,7 @@ core:
set_value_count: 5
set_value_fanout: 4
min_peer_count: 20
min_peer_refresh_time_ms: 2000
min_peer_refresh_time_ms: 60000
validate_dial_info_receipt_time_ms: 2000
local_subkey_cache_size: 128
local_max_subkey_cache_memory_mb: 256
@ -1620,7 +1620,7 @@ mod tests {
assert_eq!(s.core.network.dht.set_value_count, 5u32);
assert_eq!(s.core.network.dht.set_value_fanout, 4u32);
assert_eq!(s.core.network.dht.min_peer_count, 20u32);
assert_eq!(s.core.network.dht.min_peer_refresh_time_ms, 2_000u32);
assert_eq!(s.core.network.dht.min_peer_refresh_time_ms, 60_000u32);
assert_eq!(
s.core.network.dht.validate_dial_info_receipt_time_ms,
2_000u32