fix fastopen local
This commit is contained in:
parent
adda6d6e29
commit
8d25047d56
1 changed files with 3 additions and 1 deletions
|
@ -84,6 +84,7 @@ class TCPRelayHandler(object):
|
||||||
self._stage = STAGE_INIT
|
self._stage = STAGE_INIT
|
||||||
self._encryptor = encrypt.Encryptor(config['password'],
|
self._encryptor = encrypt.Encryptor(config['password'],
|
||||||
config['method'])
|
config['method'])
|
||||||
|
self._fastopen_connected = False
|
||||||
self._data_to_write_to_local = []
|
self._data_to_write_to_local = []
|
||||||
self._data_to_write_to_remote = []
|
self._data_to_write_to_remote = []
|
||||||
self._upstream_status = WAIT_STATUS_READING
|
self._upstream_status = WAIT_STATUS_READING
|
||||||
|
@ -172,9 +173,10 @@ class TCPRelayHandler(object):
|
||||||
if self._is_local:
|
if self._is_local:
|
||||||
data = self._encryptor.encrypt(data)
|
data = self._encryptor.encrypt(data)
|
||||||
self._data_to_write_to_remote.append(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']:
|
self._config['fast_open']:
|
||||||
try:
|
try:
|
||||||
|
self._fastopen_connected = True
|
||||||
data = ''.join(self._data_to_write_to_local)
|
data = ''.join(self._data_to_write_to_local)
|
||||||
l = len(data)
|
l = len(data)
|
||||||
s = self._remote_sock.sendto(data, MSG_FASTOPEN,
|
s = self._remote_sock.sendto(data, MSG_FASTOPEN,
|
||||||
|
|
Loading…
Reference in a new issue