From c1b322a01e21e3698a59d0d67cc35fa1d8de2f34 Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Sun, 3 Sep 2023 19:08:20 +0800 Subject: [PATCH] log some errors --- src/tun2proxy.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tun2proxy.rs b/src/tun2proxy.rs index e3820ba..ba71944 100644 --- a/src/tun2proxy.rs +++ b/src/tun2proxy.rs @@ -413,7 +413,9 @@ impl<'a> TunToProxy<'a> { .have_data(Direction::Outgoing(OutgoingDirection::ToServer)) { // Close remote server - _ = state.mio_stream.shutdown(Shutdown::Write); + if let Err(err) = state.mio_stream.shutdown(Shutdown::Write) { + log::trace!("Shutdown {} error \"{}\"", info, err); + } closed_ends += 1; } @@ -1050,9 +1052,13 @@ impl<'a> TunToProxy<'a> { // The handler request for reset the server connection if state.proxy_handler.reset_connection() { - _ = self.poll.registry().deregister(&mut state.mio_stream); + if let Err(err) = self.poll.registry().deregister(&mut state.mio_stream) { + log::trace!("{}", err); + } // Closes the connection with the proxy - state.mio_stream.shutdown(Shutdown::Both)?; + if let Err(err) = state.mio_stream.shutdown(Shutdown::Both) { + log::trace!("Shutdown error \"{}\"", err); + } log::info!("RESET {}", conn_info);