don't raise an error when we close the socket.

fix #537
This commit is contained in:
benoitc 2013-06-05 10:41:56 +02:00
parent 9673b970d0
commit e77d47cb97
2 changed files with 13 additions and 4 deletions

View File

@ -108,8 +108,12 @@ class AsyncWorker(base.Worker):
if resp.headers_sent: if resp.headers_sent:
# If the requests have already been sent, we should close the # If the requests have already been sent, we should close the
# connection to indicate the error. # connection to indicate the error.
sock.shutdown(socket.SHUT_RDWR) try:
sock.close() sock.shutdown(socket.SHUT_RDWR)
sock.close()
except socket.error:
pass
return
raise raise
finally: finally:
try: try:

View File

@ -142,8 +142,13 @@ class SyncWorker(base.Worker):
if resp.headers_sent: if resp.headers_sent:
# If the requests have already been sent, we should close the # If the requests have already been sent, we should close the
# connection to indicate the error. # connection to indicate the error.
client.shutdown(socket.SHUT_RDWR) try:
client.close() client.shutdown(socket.SHUT_RDWR)
client.close()
except socket.error:
pass
return
# Only send back traceback in HTTP in debug mode. # Only send back traceback in HTTP in debug mode.
self.handle_error(req, client, addr, e) self.handle_error(req, client, addr, e)
return return