|
@ -201,7 +201,8 @@ class TCPRelayHandler(object): |
|
|
self._config['fast_open']: |
|
|
self._config['fast_open']: |
|
|
try: |
|
|
try: |
|
|
self._fastopen_connected = True |
|
|
self._fastopen_connected = True |
|
|
remote_sock = self._create_remote_socket(self._chosen_server[0], |
|
|
remote_sock = \ |
|
|
|
|
|
self._create_remote_socket(self._chosen_server[0], |
|
|
self._chosen_server[1]) |
|
|
self._chosen_server[1]) |
|
|
self._loop.add(remote_sock, eventloop.POLL_ERR) |
|
|
self._loop.add(remote_sock, eventloop.POLL_ERR) |
|
|
data = ''.join(self._data_to_write_to_local) |
|
|
data = ''.join(self._data_to_write_to_local) |
|
@ -497,8 +498,8 @@ class TCPRelay(object): |
|
|
|
|
|
|
|
|
self._timeout = config['timeout'] |
|
|
self._timeout = config['timeout'] |
|
|
self._timeouts = [] # a list for all the handlers |
|
|
self._timeouts = [] # a list for all the handlers |
|
|
self._timeout_offset = 0 # last checked position for timeout |
|
|
|
|
|
# we trim the timeouts once a while |
|
|
# we trim the timeouts once a while |
|
|
|
|
|
self._timeout_offset = 0 # last checked position for timeout |
|
|
self._handler_to_timeouts = {} # key: handler value: index in timeouts |
|
|
self._handler_to_timeouts = {} # key: handler value: index in timeouts |
|
|
|
|
|
|
|
|
if is_local: |
|
|
if is_local: |
|
@ -606,9 +607,9 @@ class TCPRelay(object): |
|
|
try: |
|
|
try: |
|
|
logging.debug('accept') |
|
|
logging.debug('accept') |
|
|
conn = self._server_socket.accept() |
|
|
conn = self._server_socket.accept() |
|
|
TCPRelayHandler(self, self._fd_to_handlers, self._eventloop, |
|
|
TCPRelayHandler(self, self._fd_to_handlers, |
|
|
conn[0], self._config, self._dns_resolver, |
|
|
self._eventloop, conn[0], self._config, |
|
|
self._is_local) |
|
|
self._dns_resolver, self._is_local) |
|
|
except (OSError, IOError) as e: |
|
|
except (OSError, IOError) as e: |
|
|
error_no = eventloop.errno_from_exception(e) |
|
|
error_no = eventloop.errno_from_exception(e) |
|
|
if error_no in (errno.EAGAIN, errno.EINPROGRESS, |
|
|
if error_no in (errno.EAGAIN, errno.EINPROGRESS, |
|
|