From d65af355f1bfd81cc2220bd9a46a2a6ace0f1f8c Mon Sep 17 00:00:00 2001 From: ospab Date: Fri, 19 Jun 2026 23:57:35 +0300 Subject: [PATCH] Fix handshake timeouts in OSTP outbounds and remove test_parse --- ostp-client/src/tunnel/outbounds/ostp.rs | 10 +++++----- ostp/Cargo.toml | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ostp-client/src/tunnel/outbounds/ostp.rs b/ostp-client/src/tunnel/outbounds/ostp.rs index 3de8466..61e1189 100644 --- a/ostp-client/src/tunnel/outbounds/ostp.rs +++ b/ostp-client/src/tunnel/outbounds/ostp.rs @@ -98,7 +98,7 @@ pub async fn dial_tcp( let mut buf = [0u8; 8192]; let mut handshake_success = false; match tokio::time::timeout( - std::time::Duration::from_millis(3000), + std::time::Duration::from_millis(15000), transport.recv(&mut buf), ).await { Ok(Ok(n)) => { @@ -108,7 +108,7 @@ pub async fn dial_tcp( } } _ => { - tracing::warn!("TCP handshake timeout for {}:{}", server_str, port); + tracing::warn!("OSTP handshake timeout for {}:{}", server_str, port); return; } } @@ -133,7 +133,7 @@ pub async fn dial_tcp( // The kernel will buffer incoming data from server_stream while we wait. let mut connect_ok = false; match tokio::time::timeout( - std::time::Duration::from_secs(10), + std::time::Duration::from_secs(30), async { let mut wait_buf = [0u8; 8192]; loop { @@ -247,14 +247,14 @@ pub async fn handle_udp( // Wait for handshake response (server sends HandshakePayload back) let mut buf = [0u8; 8192]; match tokio::time::timeout( - std::time::Duration::from_millis(2000), + std::time::Duration::from_millis(15000), transport.recv(&mut buf), ).await { Ok(Ok(n)) => { let _ = machine.on_event(OstpEvent::Inbound(bytes::Bytes::copy_from_slice(&buf[..n]))); } _ => { - tracing::warn!("UDP handshake timeout for {}:{}", server, port); + tracing::warn!("OSTP handshake timeout for {}:{}", server, port); return Ok(()); } } diff --git a/ostp/Cargo.toml b/ostp/Cargo.toml index 00ead88..320c7c6 100644 --- a/ostp/Cargo.toml +++ b/ostp/Cargo.toml @@ -24,6 +24,3 @@ reqwest = { version = "0.12", default-features = false, features = ["blocking", pico-args = "0.5.0" clipboard-win = "3.1.1" -[[bin]] -name = "test_parse" -path = "../test_parse.rs"