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

index 6e9ce2968a0826fb386b10c6dc3c3a6a71f7bb03..7948c4c3b4efe69fbd1db2e3c76ecc667093d073 100644 (file)
@@ -686,12 +686,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 7bd46d5578750ecac9383587b9c808d289a34c5e..213a6e9c2f64422a3d31fb75e13bda428735c14a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -49,6 +49,9 @@ Core and Builtins
 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