mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
d48b968cb9
commit
70f23a4c76
@ -638,7 +638,7 @@ class ServerLoop(object):
|
||||
self.pre_activated_socket = None
|
||||
self.setup_socket()
|
||||
|
||||
self.socket.listen(self.opts.request_queue_size)
|
||||
self.socket.listen(5)
|
||||
self.bound_address = ba = self.socket.getsockname()
|
||||
if isinstance(ba, tuple):
|
||||
ba = ':'.join(map(type(''), ba))
|
||||
|
@ -92,12 +92,14 @@ def error_codes(*errnames):
|
||||
ans.discard(None)
|
||||
return ans
|
||||
|
||||
socket_error_eintr = error_codes("EINTR", "WSAEINTR")
|
||||
socket_errors_eintr = error_codes("EINTR", "WSAEINTR")
|
||||
|
||||
socket_errors_to_ignore = error_codes( # errors indicating a closed connection
|
||||
socket_errors_socket_closed = error_codes( # errors indicating a disconnected connection
|
||||
"EPIPE",
|
||||
"EBADF", "WSAEBADF",
|
||||
"ENOTSOCK", "WSAENOTSOCK",
|
||||
"ENOTCONN", "WSAENOTCONN",
|
||||
"ESHUTDOWN", "WSAESHUTDOWN",
|
||||
"ETIMEDOUT", "WSAETIMEDOUT",
|
||||
"ECONNREFUSED", "WSAECONNREFUSED",
|
||||
"ECONNRESET", "WSAECONNRESET",
|
||||
@ -171,6 +173,6 @@ def eintr_retry_call(func, *args, **kwargs):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except EnvironmentError as e:
|
||||
if getattr(e, 'errno', None) in socket_error_eintr:
|
||||
if getattr(e, 'errno', None) in socket_errors_eintr:
|
||||
continue
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user