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:
Paul J. Davis 2010-02-25 09:38:32 -05:00
parent f03ae0646d
commit 9c60695713
2 changed files with 1 additions and 5 deletions

View File

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

View File

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