Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
duration
  • Loading branch information
drdrsh committed Jul 12, 2023
commit 1852009316bf08bdddea690d0012b6af4dd0dd1e
8 changes: 6 additions & 2 deletions src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,15 +661,19 @@ pub fn configure_socket(stream: &TcpStream) {
match sock_ref.set_keepalive(true) {
Ok(_) => {
#[cfg(target_os = "linux")]
sock_ref.set_tcp_user_timeout(Some(10)).unwrap();
match sock_ref.set_tcp_user_timeout(Duration::from_millis(1000)) {
Ok(_) => (),
Err(err) => error!("Could not configure tcp_user_timeout for socket: {}", err),
}

match sock_ref.set_tcp_keepalive(
&TcpKeepalive::new()
.with_interval(Duration::from_secs(conf.general.tcp_keepalives_interval))
.with_retries(conf.general.tcp_keepalives_count)
.with_time(Duration::from_secs(conf.general.tcp_keepalives_idle)),
) {
Ok(_) => (),
Err(err) => error!("Could not configure socket: {}", err),
Err(err) => error!("Could not configure tcp_keepalive for socket: {}", err),
}
}
Err(err) => error!("Could not configure socket: {}", err),
Expand Down