summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-12-16 16:51:57 (GMT)
committerYury Selivanov <yury@magic.io>2016-12-16 16:51:57 (GMT)
commit11c135136d1fd5a14afdfeabf9d8fcd386a1c105 (patch)
tree104f1abb9efea06a5a11ef45f3f40c8e69fc9c90
parentcb5fe9c22c6b19acf1216a93856b7bdc2bb06677 (diff)
parentb1461aa78139cd849b507049a77ad2635b78f8a3 (diff)
downloadcpython-11c135136d1fd5a14afdfeabf9d8fcd386a1c105.zip
cpython-11c135136d1fd5a14afdfeabf9d8fcd386a1c105.tar.gz
cpython-11c135136d1fd5a14afdfeabf9d8fcd386a1c105.tar.bz2
Merge 3.5 (issue #28990)
-rw-r--r--Lib/asyncio/sslproto.py1
-rw-r--r--Lib/test/test_asyncio/test_sslproto.py10
-rw-r--r--Misc/NEWS4
3 files changed, 15 insertions, 0 deletions
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index 991c77b..7ad28d6 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -480,6 +480,7 @@ class SSLProtocol(protocols.Protocol):
self._loop.call_soon(self._app_protocol.connection_lost, exc)
self._transport = None
self._app_transport = None
+ self._wakeup_waiter(exc)
def pause_writing(self):
"""Called when the low-level transport's buffer goes over
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index 0ca6d1b..59ff0f6 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -85,5 +85,15 @@ class SslProtoHandshakeTests(test_utils.TestCase):
# Restore error logging.
log.logger.setLevel(log_level)
+ def test_connection_lost(self):
+ # From issue #472.
+ # yield from waiter hang if lost_connection was called.
+ waiter = asyncio.Future(loop=self.loop)
+ ssl_proto = self.ssl_protocol(waiter)
+ self.connection_made(ssl_proto)
+ ssl_proto.connection_lost(ConnectionAbortedError)
+ test_utils.run_briefly(self.loop)
+ self.assertIsInstance(waiter.exception(), ConnectionAbortedError)
+
if __name__ == '__main__':
unittest.main()
diff --git a/Misc/NEWS b/Misc/NEWS
index 477dc9b..fbe26da 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -44,6 +44,10 @@ Library
now when the grp module cannot be imported, as for example on Android
platforms.
+- Issue #28990: Fix SSL hanging if connection is closed before handshake
+ completed.
+ (Patch by HoHo-Ho)
+
Windows
-------