udp: add config setting for network poll timeout

This commit is contained in:
Joakim Frostegård 2021-11-19 01:23:41 +01:00
parent 029193b512
commit dc841ef0de
2 changed files with 4 additions and 2 deletions

View file

@ -74,6 +74,7 @@ pub struct NetworkConfig {
/// $ sudo sysctl -w net.core.rmem_default=104857600
pub socket_recv_buffer_size: usize,
pub poll_event_capacity: usize,
pub poll_timeout_ms: u64,
}
impl Default for NetworkConfig {
@ -83,6 +84,7 @@ impl Default for NetworkConfig {
only_ipv6: false,
socket_recv_buffer_size: 4096 * 128,
poll_event_capacity: 4096,
poll_timeout_ms: 50,
}
}
}

View file

@ -138,7 +138,7 @@ pub fn run_socket_worker(
let mut local_responses: Vec<(Response, SocketAddr)> = Vec::new();
let timeout = Duration::from_millis(50);
let poll_timeout = Duration::from_millis(config.network.poll_timeout_ms);
let connection_cleaning_duration =
Duration::from_secs(config.cleaning.connection_cleaning_interval);
@ -154,7 +154,7 @@ pub fn run_socket_worker(
let mut iter_counter = 0usize;
loop {
poll.poll(&mut events, Some(timeout))
poll.poll(&mut events, Some(poll_timeout))
.expect("failed polling");
for event in events.iter() {