From 833c98e1149d883d0ebb5657e924c71ef58cbd63 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Sun, 2 Nov 2014 00:23:44 +0800 Subject: [PATCH 1/2] tcprelay.py: decode remote_addr to fix extra b'' in logging on python 3 --- shadowsocks/tcprelay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 724c1ed..f772c93 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -261,7 +261,7 @@ class TCPRelayHandler(object): if header_result is None: raise Exception('can not parse header') addrtype, remote_addr, remote_port, header_length = header_result - logging.info('connecting %s:%d' % (remote_addr, remote_port)) + logging.info('connecting %s:%d' % (remote_addr.decode('utf-8'), remote_port)) self._remote_address = (remote_addr, remote_port) # pause reading self._update_stream(STREAM_UP, WAIT_STATUS_WRITING) From d971cb44a8810205918d88e8062e0e24536750fa Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Sun, 2 Nov 2014 00:41:29 +0800 Subject: [PATCH 2/2] tcprelay.py: wrap long line for PEP8 --- shadowsocks/tcprelay.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index f772c93..4a30b42 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -261,7 +261,8 @@ class TCPRelayHandler(object): if header_result is None: raise Exception('can not parse header') addrtype, remote_addr, remote_port, header_length = header_result - logging.info('connecting %s:%d' % (remote_addr.decode('utf-8'), remote_port)) + logging.info('connecting %s:%d' % (remote_addr.decode('utf-8'), + remote_port)) self._remote_address = (remote_addr, remote_port) # pause reading self._update_stream(STREAM_UP, WAIT_STATUS_WRITING)