After closing for error do not keep alive

Raise a StopIteration rather than returning so that the keep-alive
loop is terminated. If gunicorn has closed the socket there is no
sense in trying to read another request and it may cause spurious
EBADF errors to try.
This commit is contained in:
Randall Leeds 2013-08-07 19:57:56 -07:00
parent 90fb09f618
commit fa9d028d09
2 changed files with 2 additions and 3 deletions

View File

@ -113,7 +113,7 @@ class AsyncWorker(base.Worker):
sock.close()
except socket.error:
pass
return
raise StopIteration()
raise
finally:
try:

View File

@ -152,8 +152,7 @@ class SyncWorker(base.Worker):
client.close()
except socket.error:
pass
return
raise StopIteration()
# Only send back traceback in HTTP in debug mode.
self.handle_error(req, client, addr, e)
return