fix workers
This commit is contained in:
parent
d319fab5ca
commit
e8b2946999
3 changed files with 9 additions and 3 deletions
|
@ -425,7 +425,9 @@ class DNSResolver(object):
|
|||
|
||||
def close(self):
|
||||
if self._sock:
|
||||
self._loop.remove(self._sock, self)
|
||||
if self._loop:
|
||||
self._loop.remove_periodic(self.handle_periodic)
|
||||
self._loop.remove(self._sock, self)
|
||||
self._sock.close()
|
||||
self._sock = None
|
||||
|
||||
|
|
|
@ -703,4 +703,7 @@ class TCPRelay(object):
|
|||
def close(self, next_tick=False):
|
||||
self._closed = True
|
||||
if not next_tick:
|
||||
if self._eventloop:
|
||||
self._eventloop.remove_periodic(self.handle_periodic)
|
||||
self._eventloop.remove(self._server_socket, self)
|
||||
self._server_socket.close()
|
||||
|
|
|
@ -278,10 +278,11 @@ class UDPRelay(object):
|
|||
self._server_socket.close()
|
||||
for sock in self._sockets:
|
||||
sock.close()
|
||||
self._eventloop.remove_periodic(self.handle_periodic)
|
||||
|
||||
def close(self, next_tick=False):
|
||||
self._closed = True
|
||||
if not next_tick:
|
||||
self._eventloop.remove(self._server_socket, self)
|
||||
if self._eventloop:
|
||||
self._eventloop.remove_periodic(self.handle_periodic)
|
||||
self._eventloop.remove(self._server_socket, self)
|
||||
self._server_socket.close()
|
||||
|
|
Loading…
Reference in a new issue