From 5c11527e1b1294d6e5195e3b0bec34276d4bb950 Mon Sep 17 00:00:00 2001 From: mengskysama Date: Sun, 4 Sep 2016 01:18:13 -0700 Subject: [PATCH] fix ota call write_to_sock multi --- shadowsocks/tcprelay.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 54c364f..810e713 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -449,6 +449,7 @@ class TCPRelayHandler(object): def _ota_chunk_data(self, data, data_cb): # spec https://shadowsocks.org/en/spec/one-time-auth.html + unchunk_data = b'' while len(data) > 0: if self._ota_len == 0: # get DATA.LEN + HMAC-SHA1 @@ -472,11 +473,12 @@ class TCPRelayHandler(object): if onetimeauth_verify(_hash, _data, key) is False: logging.warn('one time auth fail, drop chunk !') else: - data_cb(self._ota_buff_data) + unchunk_data += _data self._ota_chunk_idx += 1 self._ota_buff_head = b'' self._ota_buff_data = b'' self._ota_len = 0 + data_cb(unchunk_data) return def _ota_chunk_data_gen(self, data):