Commit 155b462c authored by Jason Madden's avatar Jason Madden

Merge branch 'no-broken-pipe-tracebacks' of https://github.com/plangrid/gevent into pr377

parents d3a3a525 524a51e6
......@@ -368,16 +368,7 @@ class WSGIHandler(object):
self.environ = self.get_environ()
self.application = self.server.application
try:
self.handle_one_response()
except socket.error as ex:
# Broken pipe, connection reset by peer
if ex.args[0] in (errno.EPIPE, errno.ECONNRESET):
if not PY3:
sys.exc_clear()
return
else:
raise
self.handle_one_response()
if self.close_connection:
return
......@@ -546,6 +537,14 @@ class WSGIHandler(object):
if close is not None:
close()
self.wsgi_input._discard()
except socket.error as ex:
# Broken pipe, connection reset by peer
if ex.args[0] in (errno.EPIPE, errno.ECONNRESET):
if not PY3:
sys.exc_clear()
self.close_connection = True
else:
self.handle_error(*sys.exc_info())
except:
self.handle_error(*sys.exc_info())
finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment