From 1b2ed7a10dfd738d8895923edc495daf2fc9a1ed Mon Sep 17 00:00:00 2001 From: PinkP4nther <0x0090@protonmail.com> Date: Sun, 10 Oct 2021 00:48:53 -0700 Subject: [PATCH] Silenced channel send error for StreamWrite's to master thread. If client disconnects before server send response the relay will now just silently close the connection. --- Cargo.toml | 2 +- src/data.rs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2938cd6..395b376 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sslrelay" -version = "0.6.0" +version = "0.6.1" authors = ["PinkP4nther @Pink_P4nther"] edition = "2018" description = "A TCP relay library for relaying/modifying/spoofing TCP traffic by implementing callback code." diff --git a/src/data.rs b/src/data.rs index 0a16fd6..32d2655 100644 --- a/src/data.rs +++ b/src/data.rs @@ -79,7 +79,9 @@ impl DownStreamInner { if byte_count > 0 { if let Err(e) = data_out.send(FullDuplexTcpState::UpStreamWrite(self.internal_data_buffer.clone())) { - Self::handle_error(format!("Failed to send UpStreamWrite to main thread: {}", e).as_str()); + + //Self::handle_error(format!("Failed to send UpStreamWrite to main thread: {}", e).as_str()); + let _ = raw_stream.shutdown(Shutdown::Both); return; } @@ -150,7 +152,8 @@ impl DownStreamInner { if byte_count > 0 { if let Err(e) = data_out.send(FullDuplexTcpState::UpStreamWrite(self.internal_data_buffer.clone())) { - Self::handle_error(format!("Failed to send UpStreamWrite to main thread: {}", e).as_str()); + + //Self::handle_error(format!("Failed to send UpStreamWrite to main thread: {}", e).as_str()); let _ = tls_stream.shutdown(); return; } @@ -292,7 +295,9 @@ impl UpStreamInner { if byte_count > 0 { if let Err(e) = data_out.send(FullDuplexTcpState::DownStreamWrite(self.internal_data_buffer.clone())) { - Self::handle_error(format!("Failed to send DownStreamWrite to main thread: {}", e).as_str()); + + //Self::handle_error(format!("Failed to send DownStreamWrite to main thread: {}", e).as_str()); + let _ = raw_stream.shutdown(Shutdown::Both); return; } @@ -359,7 +364,9 @@ impl UpStreamInner { if byte_count > 0 { if let Err(e) = data_out.send(FullDuplexTcpState::DownStreamWrite(self.internal_data_buffer.clone())) { - Self::handle_error(format!("Failed to send DownStreamWrite to main thread: {}", e).as_str()); + + //Self::handle_error(format!("Failed to send DownStreamWrite to main thread: {}", e).as_str()); + let _ = tls_stream.shutdown(); return; }