]> granicus.if.org Git - python/commitdiff
Break circular references when closing SSLTransport objects (#981) (#2048)
authorYury Selivanov <yury@magic.io>
Fri, 9 Jun 2017 23:14:24 +0000 (19:14 -0400)
committerGitHub <noreply@github.com>
Fri, 9 Jun 2017 23:14:24 +0000 (19:14 -0400)
Lib/asyncio/sslproto.py
Misc/NEWS

index 31803ac3b0dc8ff91f2d030bc2fef92cb9361e1f..61d478ebda6c78b8bebb5a67ddd37bd126d0ef69 100644 (file)
@@ -685,12 +685,14 @@ class SSLProtocol(protocols.Protocol):
             self._transport._force_close(exc)
 
     def _finalize(self):
+        self._sslpipe = None
+
         if self._transport is not None:
             self._transport.close()
 
     def _abort(self):
-        if self._transport is not None:
-            try:
+        try:
+            if self._transport is not None:
                 self._transport.abort()
-            finally:
-                self._finalize()
+        finally:
+            self._finalize()
index 05331939f6efe4057928dee69e9379f78055768c..5edf13b98cdb9495228f763774ec645fab7def18 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -56,6 +56,9 @@ Extension Modules
 Library
 -------
 
+- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl
+  implementation. Patch by Michaël Sghaïer.
+
 - bpo-29743: Closing transport during handshake process leaks open socket.
   Patch by Nikolay Kim