Browse Source

fix fastopen local

auth
clowwindy 11 years ago
parent
commit
a08edd2007
  1. 5
      shadowsocks/tcprelay.py

5
shadowsocks/tcprelay.py

@ -181,15 +181,16 @@ class TCPRelayHandler(object):
l = len(data) l = len(data)
s = self._remote_sock.sendto(data, MSG_FASTOPEN, s = self._remote_sock.sendto(data, MSG_FASTOPEN,
self.remote_address) self.remote_address)
self._loop.add(self._remote_sock,
eventloop.POLL_ERR | eventloop.POLL_OUT)
self._update_stream(STREAM_DOWN, WAIT_STATUS_READING)
if s < l: if s < l:
data = data[s:] data = data[s:]
self._data_to_write_to_local = [data] self._data_to_write_to_local = [data]
self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING) self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING)
self._update_stream(STREAM_DOWN, WAIT_STATUS_READING)
else: else:
self._data_to_write_to_local = [] self._data_to_write_to_local = []
self._update_stream(STREAM_UP, WAIT_STATUS_READING) self._update_stream(STREAM_UP, WAIT_STATUS_READING)
self._update_stream(STREAM_DOWN, WAIT_STATUS_READING)
self._stage = STAGE_STREAM self._stage = STAGE_STREAM
except (OSError, IOError) as e: except (OSError, IOError) as e:
if eventloop.errno_from_exception(e) == errno.EINPROGRESS: if eventloop.errno_from_exception(e) == errno.EINPROGRESS:

Loading…
Cancel
Save