From 96760ed4384ed3755c185e065f4e5c79e80f6028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Mon, 23 Jan 2017 16:28:59 +0800 Subject: [PATCH] not display RST error --- shadowsocks/tcprelay.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 28eed26..571fe42 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -880,20 +880,22 @@ class TCPRelayHandler(object): self._update_stream(STREAM_UP, WAIT_STATUS_READING) def _on_local_error(self): - logging.debug('got local error') if self._local_sock: - logging.error(eventloop.get_sock_error(self._local_sock)) - logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + err = eventloop.get_sock_error(self._local_sock) + if err.errno not in [errno.ECONNRESET]: + logging.error(err) + logging.error("local error, exception from %s:%d" % (self._client_address[0], self._client_address[1])) self.destroy() def _on_remote_error(self): - logging.debug('got remote error') if self._remote_sock: - logging.error(eventloop.get_sock_error(self._remote_sock)) - if self._remote_address: - logging.error("when connect to %s:%d" % (self._remote_address[0], self._remote_address[1])) - else: - logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + err = eventloop.get_sock_error(self._remote_sock) + if err.errno not in [errno.ECONNRESET]: + logging.error(err) + if self._remote_address: + logging.error("remote error, when connect to %s:%d" % (self._remote_address[0], self._remote_address[1])) + else: + logging.error("remote error, exception from %s:%d" % (self._client_address[0], self._client_address[1])) self.destroy() def handle_event(self, sock, event):