Server disconnection works properly
This commit is contained in:
parent
dcce36eb7c
commit
038590c659
4 changed files with 5 additions and 5 deletions
|
|
@ -70,9 +70,10 @@ class AbstractServer(io.IOBase):
|
|||
def write_select(self):
|
||||
"""Internal function used by the select function"""
|
||||
try:
|
||||
_wlist.remove(self)
|
||||
while not self._sending_queue.empty():
|
||||
self._write(self._sending_queue.get_nowait())
|
||||
_wlist.remove(self)
|
||||
self._sending_queue.task_done()
|
||||
|
||||
except queue.Empty:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -57,8 +57,9 @@ class SocketServer(AbstractServer):
|
|||
return True
|
||||
|
||||
def _close(self):
|
||||
self._sending_queue.join()
|
||||
if self.socket is not None:
|
||||
self.socket.shutdown(SHUT_RDWR)
|
||||
self.socket.shutdown(socket.SHUT_RDWR)
|
||||
self.socket.close()
|
||||
self.socket = None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue