Browse Source

Issue #14574: Ignore socket errors raised when flushing a connection on close.

pull/2332/head
Kristján Valur Jónsson 13 years ago
parent
commit
36852b7844
  1. 4
      Doc/library/socketserver.rst
  2. 7
      Lib/socketserver.py

4
Doc/library/socketserver.rst

@ -299,8 +299,8 @@ request.
.. method:: RequestHandler.finish()
Called after the :meth:`handle` method to perform any clean-up actions
required. The default implementation does nothing. If :meth:`setup` or
:meth:`handle` raise an exception, this function will not be called.
required. The default implementation does nothing. If :meth:`setup`
raises an exception, this function will not be called.
.. method:: RequestHandler.handle()

7
Lib/socketserver.py

@ -700,7 +700,12 @@ class StreamRequestHandler(BaseRequestHandler):
def finish(self):
if not self.wfile.closed:
self.wfile.flush()
try:
self.wfile.flush()
except socket.error:
# An final socket error may have occurred here, such as
# the local error ECONNABORTED.
pass
self.wfile.close()
self.rfile.close()

Loading…
Cancel
Save