close streams immediately after connect error
This commit is contained in:
parent
69b8342a8d
commit
800ca15eb9
@ -12,14 +12,14 @@ lexopt = { version = "0.3.0", default-features = false }
|
||||
log = { version = "0.4.17", default-features = false, features = ["serde", "std"] }
|
||||
once_cell = { version = "1.17.1", default-features = false, features = ["parking_lot", "std"] }
|
||||
parking_lot = { version = "0.12.1", default-features = false, features = ["send_guard"] }
|
||||
quinn = { version = "0.10.0", default-features = false, features = ["futures-io", "runtime-tokio", "tls-rustls"] }
|
||||
quinn = { version = "0.10.1", default-features = false, features = ["futures-io", "runtime-tokio", "tls-rustls"] }
|
||||
register-count = { version = "0.1.0", default-features = false, features = ["std"] }
|
||||
rustls = { version = "0.21.1", default-features = false, features = ["quic"] }
|
||||
rustls-native-certs = { version = "0.6.2", default-features = false }
|
||||
rustls-pemfile = { version = "1.0.2", default-features = false }
|
||||
serde = { version = "1.0.163", default-features = false, features = ["derive", "std"] }
|
||||
serde_json = { version = "1.0.96", default-features = false, features = ["std"] }
|
||||
socket2 = { version = "0.5.2", default-features = false }
|
||||
socket2 = { version = "0.5.3", default-features = false }
|
||||
socks5-proto = { version = "0.3.3", default-features = false }
|
||||
socks5-server = { version = "0.8.3", default-features = false }
|
||||
thiserror = { version = "1.0.40", default-features = false }
|
||||
@ -27,4 +27,4 @@ tokio = { version = "1.28.1", default-features = false, features = ["io-util", "
|
||||
tokio-util = { version = "0.7.8", default-features = false, features = ["compat"] }
|
||||
tuic = { path = "../tuic", default-features = false }
|
||||
tuic-quinn = { path = "../tuic-quinn", default-features = false }
|
||||
uuid = { version = "1.3.2", default-features = false, features = ["serde", "std"] }
|
||||
uuid = { version = "1.3.3", default-features = false, features = ["serde", "std"] }
|
||||
|
@ -2,6 +2,7 @@ use crate::{config::Local, connection::Connection as TuicConnection, Error};
|
||||
use bytes::Bytes;
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
use quinn::VarInt;
|
||||
use socket2::{Domain, Protocol, SockAddr, Socket, Type};
|
||||
use socks5_proto::{Address, Reply};
|
||||
use socks5_server::{
|
||||
@ -185,7 +186,7 @@ impl Server {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => {
|
||||
let _ = conn.shutdown().await;
|
||||
let _ = relay.shutdown().await;
|
||||
let _ = relay.get_mut().reset(VarInt::from_u32(0));
|
||||
Err(Error::from(err))
|
||||
}
|
||||
},
|
||||
|
@ -11,16 +11,16 @@ humantime = { version = "2.1.0", default-features = false }
|
||||
lexopt = { version = "0.3.0", default-features = false }
|
||||
log = { version = "0.4.17", default-features = false, features = ["serde", "std"] }
|
||||
parking_lot = { version = "0.12.1", default-features = false }
|
||||
quinn = { version = "0.10.0", default-features = false, features = ["futures-io", "runtime-tokio", "tls-rustls"] }
|
||||
quinn = { version = "0.10.1", default-features = false, features = ["futures-io", "runtime-tokio", "tls-rustls"] }
|
||||
register-count = { version = "0.1.0", default-features = false, features = ["std"] }
|
||||
rustls = { version = "0.21.1", default-features = false, features = ["quic"] }
|
||||
rustls-pemfile = { version = "1.0.2", default-features = false }
|
||||
serde = { version = "1.0.163", default-features = false, features = ["derive", "std"] }
|
||||
serde_json = { version = "1.0.96", default-features = false, features = ["std"] }
|
||||
socket2 = { version = "0.5.2", default-features = false }
|
||||
socket2 = { version = "0.5.3", default-features = false }
|
||||
thiserror = { version = "1.0.40", default-features = false }
|
||||
tokio = { version = "1.28.1", default-features = false, features = ["io-util", "macros", "net", "parking_lot", "rt-multi-thread", "time"] }
|
||||
tokio-util = { version = "0.7.8", default-features = false, features = ["compat"] }
|
||||
tuic = { path = "../tuic", default-features = false }
|
||||
tuic-quinn = { path = "../tuic-quinn", default-features = false }
|
||||
uuid = { version = "1.3.2", default-features = false, features = ["serde", "std"] }
|
||||
uuid = { version = "1.3.3", default-features = false, features = ["serde", "std"] }
|
||||
|
@ -471,7 +471,7 @@ impl Connection {
|
||||
if let Some(mut stream) = stream {
|
||||
let mut conn = conn.compat();
|
||||
let res = io::copy_bidirectional(&mut conn, &mut stream).await;
|
||||
let _ = conn.shutdown().await;
|
||||
let _ = conn.get_mut().reset(VarInt::from_u32(0));
|
||||
let _ = stream.shutdown().await;
|
||||
res?;
|
||||
Ok(())
|
||||
|
Loading…
x
Reference in New Issue
Block a user