This commit is contained in:
benoitc 2010-01-21 18:56:24 +01:00
parent a79f2e6156
commit 9422ee545e
2 changed files with 4 additions and 16 deletions

View File

@ -18,7 +18,6 @@ CHUNK_SIZE = (16 * 1024)
MAX_BODY = 1024 * (80 + 32)
weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
monthname = [None,
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
@ -60,8 +59,6 @@ def write(sock, data):
except socket.error, e:
if e[0] in (errno.EWOULDBLOCK, errno.EAGAIN):
break
elif e[0] in (errno.EPIPE,):
break
raise
i += 1

View File

@ -80,8 +80,6 @@ class Worker(object):
try:
client, addr = self.socket.accept()
self.client = client
# handle connection
self.handle(client, addr)
@ -91,17 +89,9 @@ class Worker(object):
self._fchmod(spinner)
nr += 1
except socket.error, e:
if e[0] in (errno.EAGAIN, errno.EWOULDBLOCK,
errno.ECONNABORTED):
if e[0] in (errno.EAGAIN, errno.ECONNABORTED):
break # Uh oh!
elif e[0] in (errno.EMFILE, errno.ENOBUFS, errno.ENFILE,
errno.ENOMEM):
"""
linux gave EMFILE when a process is not allowed to
allocate more fs or ENOMEM when there is not enough
memory to allocate. BSD return ENOBUFS.
"""
log.warning("Could not accept new connection (%s)" % str(e))
raise
if nr == 0: break
@ -130,5 +120,6 @@ class Worker(object):
http.HttpResponse(client, response, req).send()
except Exception, e:
self.log.exception("Error processing request. [%s]" % str(e))
finally:
util.close(client)