From 41e9489f3055d793cfc185a7d8827af4c6bab128 Mon Sep 17 00:00:00 2001 From: EAimTY Date: Sat, 4 Feb 2023 16:35:38 +0900 Subject: [PATCH] prevent system from rebinding UDP socket too early --- tuic-client/src/connection.rs | 5 ++++- tuic-client/src/socks5.rs | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tuic-client/src/connection.rs b/tuic-client/src/connection.rs index 81f94c6..fe375d4 100644 --- a/tuic-client/src/connection.rs +++ b/tuic-client/src/connection.rs @@ -137,7 +137,10 @@ impl Endpoint { let conn = if zero_rtt_handshake { match conn.into_0rtt() { Ok((conn, _)) => conn, - Err(conn) => conn.await?, + Err(conn) => { + eprintln!("0-RTT handshake failed, fallback to 1-RTT handshake"); + conn.await? + } } } else { conn.await? diff --git a/tuic-client/src/socks5.rs b/tuic-client/src/socks5.rs index 2b88217..c14ef47 100644 --- a/tuic-client/src/socks5.rs +++ b/tuic-client/src/socks5.rs @@ -125,7 +125,6 @@ impl Server { socket.set_only_v6(!dual_stack)?; } - socket.set_reuse_address(true)?; socket.bind(&SockAddr::from(SERVER.get().unwrap().addr))?; let socket = AssociatedUdpSocket::from((