diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-16 17:05:33 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-16 17:05:33 (GMT) |
commit | 16b7b7d6acf82a63af80d55da8bf0c71edc9c8b4 (patch) | |
tree | 66a646db6f8514974ec00106d8dd13eee4e77a75 /Lib | |
parent | 20cdffd8304522a5c10b53f3dccef7e9f5d685bb (diff) | |
parent | b1461aa78139cd849b507049a77ad2635b78f8a3 (diff) | |
download | cpython-16b7b7d6acf82a63af80d55da8bf0c71edc9c8b4.zip cpython-16b7b7d6acf82a63af80d55da8bf0c71edc9c8b4.tar.gz cpython-16b7b7d6acf82a63af80d55da8bf0c71edc9c8b4.tar.bz2 |
Merge heads
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asyncio/sslproto.py | 1 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_sslproto.py | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index 804c5c3..c2c4b95 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -479,6 +479,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() |