mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ensure LinuxListener.close can be called multiple times
This commit is contained in:
parent
3686dc929c
commit
fc77917e9c
@ -123,8 +123,11 @@ if islinux:
|
||||
# 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…
x
Reference in New Issue
Block a user