diff --git a/gunicorn/util.py b/gunicorn/util.py index a7f2e901..e19dbf2e 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -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 diff --git a/gunicorn/worker.py b/gunicorn/worker.py index 10e8984d..7d90d319 100644 --- a/gunicorn/worker.py +++ b/gunicorn/worker.py @@ -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) - \ No newline at end of file +