From 36852b7844fd15fb80a9366ea861c2d5159bb51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Tue, 25 Dec 2012 22:46:32 +0000 Subject: Issue #14574: Ignore socket errors raised when flushing a connection on close. --- Doc/library/socketserver.rst | 4 ++-- Lib/socketserver.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst index 5287f17..4f22347 100644 --- a/Doc/library/socketserver.rst +++ b/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() diff --git a/Lib/socketserver.py b/Lib/socketserver.py index adf9f38..8f80a7d 100644 --- a/Lib/socketserver.py +++ b/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() -- cgit v0.12