Remove TCP keepalive socket timeouts

This commit is contained in:
Jan Trefil 2023-09-30 10:00:23 +02:00
parent 825ed09e43
commit 65083f47c1
6 changed files with 3 additions and 38 deletions

13
Cargo.lock generated
View file

@ -856,7 +856,6 @@ dependencies = [
"rkvm-input",
"serde",
"sha2",
"socket2 0.5.3",
"thiserror",
"tokio",
"tracing",
@ -1026,16 +1025,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "socket2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
dependencies = [
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "spin"
version = "0.5.2"
@ -1130,7 +1119,7 @@ dependencies = [
"num_cpus",
"pin-project-lite",
"signal-hook-registry",
"socket2 0.4.9",
"socket2",
"tokio-macros",
"windows-sys 0.48.0",
]

View file

@ -2,7 +2,7 @@ use rkvm_input::writer::Writer;
use rkvm_net::auth::{AuthChallenge, AuthStatus};
use rkvm_net::message::Message;
use rkvm_net::version::Version;
use rkvm_net::{socket, Update};
use rkvm_net::Update;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::io;
@ -40,8 +40,6 @@ pub async fn run(
_ => unimplemented!("Unhandled rustls ServerName variant: {:?}", hostname),
};
socket::configure(&stream).map_err(Error::Network)?;
tracing::info!("Connected to server");
let stream = connector

View file

@ -16,5 +16,4 @@ thiserror = "1.0.40"
hmac = "0.12.1"
sha2 = "0.10.6"
rand = "0.8.5"
socket2 = { version = "0.5.3", features = ["all"] }
tracing = "0.1.37"

View file

@ -1,6 +1,5 @@
pub mod auth;
pub mod message;
pub mod socket;
pub mod version;
use rkvm_input::abs::{AbsAxis, AbsInfo};

View file

@ -1,18 +0,0 @@
use socket2::{SockRef, TcpKeepalive};
use std::io::Error;
use std::time::Duration;
use tokio::net::TcpStream;
pub fn configure(stream: &TcpStream) -> Result<(), Error> {
stream.set_linger(None)?;
stream.set_nodelay(false)?;
SockRef::from(&stream).set_tcp_keepalive(
&TcpKeepalive::new()
.with_time(Duration::from_secs(1))
.with_interval(Duration::from_secs(10))
.with_retries(1),
)?;
Ok(())
}

View file

@ -7,7 +7,7 @@ use rkvm_input::sync::SyncEvent;
use rkvm_net::auth::{AuthChallenge, AuthResponse, AuthStatus};
use rkvm_net::message::Message;
use rkvm_net::version::Version;
use rkvm_net::{socket, Update};
use rkvm_net::Update;
use slab::Slab;
use std::collections::{HashMap, HashSet, VecDeque};
use std::ffi::CString;
@ -292,8 +292,6 @@ async fn client(
password: &str,
) -> Result<(), ClientError> {
let negotiate = async {
socket::configure(&stream)?;
let stream = acceptor.accept(stream).await?;
tracing::info!("TLS connected");