|
|
@ -632,14 +632,14 @@ class TCPRelay(object): |
|
|
|
if now - self._last_time > TIMEOUT_PRECISION: |
|
|
|
self._sweep_timeout() |
|
|
|
self._last_time = now |
|
|
|
if self._closed: |
|
|
|
if self._server_socket: |
|
|
|
self._eventloop.remove(self._server_socket) |
|
|
|
self._server_socket.close() |
|
|
|
self._server_socket = None |
|
|
|
logging.info('closed listen port %d', self._listen_port) |
|
|
|
if not self._fd_to_handlers: |
|
|
|
self._eventloop.remove_handler(self._handle_events) |
|
|
|
if self._closed: |
|
|
|
if self._server_socket: |
|
|
|
self._eventloop.remove(self._server_socket) |
|
|
|
self._server_socket.close() |
|
|
|
self._server_socket = None |
|
|
|
logging.info('closed listen port %d', self._listen_port) |
|
|
|
if not self._fd_to_handlers: |
|
|
|
self._eventloop.remove_handler(self._handle_events) |
|
|
|
|
|
|
|
def close(self, next_tick=False): |
|
|
|
self._closed = True |
|
|
|