mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Update EPIPE handling.
Now ignore EPIPE tracebacks as they're most likely just notifications that a client disconnected before reading the entire response.
This commit is contained in:
parent
f03ae0646d
commit
9c60695713
@ -106,7 +106,6 @@ def read_partial(sock, length):
|
||||
def write(sock, data):
|
||||
buf = ""
|
||||
buf += data
|
||||
i = 0
|
||||
while buf:
|
||||
try:
|
||||
bytes = sock.send(buf)
|
||||
@ -117,10 +116,7 @@ def write(sock, data):
|
||||
except socket.error, e:
|
||||
if e[0] in (errno.EWOULDBLOCK, errno.EAGAIN):
|
||||
break
|
||||
if e[0] == errno.EPIPE and i == 0:
|
||||
continue
|
||||
raise
|
||||
i += 1
|
||||
|
||||
def write_nonblock(sock, data):
|
||||
timeout = sock.gettimeout()
|
||||
|
||||
@ -112,7 +112,7 @@ class Worker(object):
|
||||
self.handle(client, addr)
|
||||
self.nr += 1
|
||||
except socket.error, e:
|
||||
if e[0] not in (errno.EAGAIN, errno.ECONNABORTED):
|
||||
if e[0] not in (errno.EAGAIN, errno.ECONNABORTED, errno.EPIPE):
|
||||
raise
|
||||
|
||||
# Keep processing clients until no one is waiting.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user