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): ...@@ -368,16 +368,7 @@ class WSGIHandler(object):
self.environ = self.get_environ() self.environ = self.get_environ()
self.application = self.server.application self.application = self.server.application
try:
self.handle_one_response() 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
if self.close_connection: if self.close_connection:
return return
...@@ -546,6 +537,14 @@ class WSGIHandler(object): ...@@ -546,6 +537,14 @@ class WSGIHandler(object):
if close is not None: if close is not None:
close() close()
self.wsgi_input._discard() 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: except:
self.handle_error(*sys.exc_info()) self.handle_error(*sys.exc_info())
finally: 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