From 5e80a71ab67045fecec46573a1892e240b569ace Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sat, 10 Mar 2018 17:48:35 +0200 Subject: bpo-33037: Skip sending/receiving after SSL transport closing (GH-6044) * Skip write()/data_received() if sslpipe is destroyed --- Lib/asyncio/sslproto.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Lib/asyncio') diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index 863b54313c..2bbf134c0f 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -504,6 +504,10 @@ class SSLProtocol(protocols.Protocol): The argument is a bytes object. """ + if self._sslpipe is None: + # transport closing, sslpipe is destroyed + return + try: ssldata, appdata = self._sslpipe.feed_ssldata(data) except ssl.SSLError as e: @@ -636,7 +640,7 @@ class SSLProtocol(protocols.Protocol): def _process_write_backlog(self): # Try to make progress on the write backlog. - if self._transport is None: + if self._transport is None or self._sslpipe is None: return try: -- cgit v1.2.1