From b3ab5d7c4c6d033b042d10ebc6f972fa3a6cebf1 Mon Sep 17 00:00:00 2001 From: BreakWa11 Date: Tue, 24 May 2016 02:21:00 +0800 Subject: [PATCH] show exception peer name --- shadowsocks/tcprelay.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 0fedd80..866cda9 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -768,12 +768,22 @@ class TCPRelayHandler(object): logging.debug('got local error') if self._local_sock: logging.error(eventloop.get_sock_error(self._local_sock)) + try: + addr = self._local_sock.getpeername()[:2] + logging.error('local exception peer name %s:%d' % (addr[0], addr[1])) + except: + pass 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)) + try: + addr = self._remote_sock.getpeername()[:2] + logging.error('remote exception peer name %s:%d' % (addr[0], addr[1])) + except: + pass self.destroy() def handle_event(self, sock, event):