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_error_eintr = error_codes("EINTR", "WSAEINTR")
|
||||||
|
|
||||||
socket_errors_to_ignore = error_codes(
|
socket_errors_to_ignore = error_codes( # errors indicating a closed connection
|
||||||
"EPIPE",
|
"EPIPE",
|
||||||
"EBADF", "WSAEBADF",
|
"EBADF", "WSAEBADF",
|
||||||
"ENOTSOCK", "WSAENOTSOCK",
|
"ENOTSOCK", "WSAENOTSOCK",
|
||||||
@ -82,7 +82,10 @@ class SocketFile(object): # {{{
|
|||||||
def close(self):
|
def close(self):
|
||||||
try:
|
try:
|
||||||
if self._sock is not None:
|
if self._sock is not None:
|
||||||
|
try:
|
||||||
self.flush()
|
self.flush()
|
||||||
|
except socket.error:
|
||||||
|
pass
|
||||||
finally:
|
finally:
|
||||||
if self._close and self._sock is not None:
|
if self._close and self._sock is not None:
|
||||||
self._sock.close()
|
self._sock.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user