mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-27 20:46:00 +01:00
Ensure LinuxListener.close can be called multiple times
This commit is contained in:
parent
3686dc929c
commit
fc77917e9c
1 changed files with 5 additions and 2 deletions
|
|
@ -123,8 +123,11 @@ def close(self):
|
|||
# shutdown() not close(). This is needed to allow calibre to
|
||||
# restart using the same socket address.
|
||||
import socket
|
||||
self._listener._socket.shutdown(socket.SHUT_RDWR)
|
||||
self._listener._socket.close()
|
||||
listener = self._listener
|
||||
if listener is not None:
|
||||
self._listener = None
|
||||
listener._socket.shutdown(socket.SHUT_RDWR)
|
||||
listener._socket.close()
|
||||
|
||||
def accept(self, *args, **kwargs):
|
||||
ans = Listener.accept(self, *args, **kwargs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue