This commit is contained in:
Kovid Goyal 2015-05-23 19:11:47 +05:30
parent d48b968cb9
commit 70f23a4c76
2 changed files with 6 additions and 4 deletions

View File

@ -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))

View File

@ -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