From 5d022e282864f1848b5e643f3cf880471939cd2a Mon Sep 17 00:00:00 2001 From: clowwindy Date: Mon, 2 Jun 2014 18:11:38 +0800 Subject: [PATCH] fix None --- shadowsocks/tcprelay.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 979d68f..318dcec 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -320,11 +320,13 @@ class TCPRelayHandler(object): self.update_stream(STREAM_UP, WAIT_STATUS_READING) def on_local_error(self): - logging.error(eventloop.get_sock_error(self._local_sock)) + if self._local_sock: + logging.error(eventloop.get_sock_error(self._local_sock)) self.destroy() def on_remote_error(self): - logging.error(eventloop.get_sock_error(self._remote_sock)) + if self._remote_sock: + logging.error(eventloop.get_sock_error(self._remote_sock)) self.destroy() def handle_event(self, sock, event):