From 8d25047d56b60e256d69d57ce137655976142363 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Tue, 3 Jun 2014 22:26:22 +0800 Subject: [PATCH] fix fastopen local --- shadowsocks/tcprelay.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 298b9dd..f0c2228 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -84,6 +84,7 @@ class TCPRelayHandler(object): self._stage = STAGE_INIT self._encryptor = encrypt.Encryptor(config['password'], config['method']) + self._fastopen_connected = False self._data_to_write_to_local = [] self._data_to_write_to_remote = [] self._upstream_status = WAIT_STATUS_READING @@ -172,9 +173,10 @@ class TCPRelayHandler(object): if self._is_local: data = self._encryptor.encrypt(data) self._data_to_write_to_remote.append(data) - if self._is_local and self._upstream_status == WAIT_STATUS_INIT and \ + if self._is_local and not self._fastopen_connected and \ self._config['fast_open']: try: + self._fastopen_connected = True data = ''.join(self._data_to_write_to_local) l = len(data) s = self._remote_sock.sendto(data, MSG_FASTOPEN,