mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ignore errors when flushing socket during close
This commit is contained in:
parent
1897119a24
commit
0b1084a7b8
@ -26,7 +26,7 @@ def error_codes(*errnames):
|
||||
|
||||
socket_error_eintr = error_codes("EINTR", "WSAEINTR")
|
||||
|
||||
socket_errors_to_ignore = error_codes(
|
||||
socket_errors_to_ignore = error_codes( # errors indicating a closed connection
|
||||
"EPIPE",
|
||||
"EBADF", "WSAEBADF",
|
||||
"ENOTSOCK", "WSAENOTSOCK",
|
||||
@ -82,7 +82,10 @@ class SocketFile(object): # {{{
|
||||
def close(self):
|
||||
try:
|
||||
if self._sock is not None:
|
||||
self.flush()
|
||||
try:
|
||||
self.flush()
|
||||
except socket.error:
|
||||
pass
|
||||
finally:
|
||||
if self._close and self._sock is not None:
|
||||
self._sock.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user