diff options
author | Yury Selivanov <yury@magic.io> | 2016-10-05 23:39:54 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-10-05 23:39:54 (GMT) |
commit | 92e7c7f99c51419e1b4aa5eaaa22b7aeb6154ffd (patch) | |
tree | a9605247f23039711d858fca83443cd1ccd2ef06 | |
parent | 8dc3e438398046c6bb989e038cd08280aa356982 (diff) | |
download | cpython-92e7c7f99c51419e1b4aa5eaaa22b7aeb6154ffd.zip cpython-92e7c7f99c51419e1b4aa5eaaa22b7aeb6154ffd.tar.gz cpython-92e7c7f99c51419e1b4aa5eaaa22b7aeb6154ffd.tar.bz2 |
asyncio: Add "call_connection_made" arg to SSLProtocol.__init__
Issue #23749: With this change it's possible to implement starttls
as a separate package on PyPI, or even by copying/pasting a small
snipped of code in your project.
It's expected that we'll figure out the API design for starttls
during 3.6, so that we can add it in 3.7.
-rw-r--r-- | Lib/asyncio/sslproto.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index afe85a1..804c5c3 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -410,7 +410,8 @@ class SSLProtocol(protocols.Protocol): """ def __init__(self, loop, app_protocol, sslcontext, waiter, - server_side=False, server_hostname=None): + server_side=False, server_hostname=None, + call_connection_made=True): if ssl is None: raise RuntimeError('stdlib ssl module not available') @@ -443,6 +444,7 @@ class SSLProtocol(protocols.Protocol): self._in_shutdown = False # transport, ex: SelectorSocketTransport self._transport = None + self._call_connection_made = call_connection_made def _wakeup_waiter(self, exc=None): if self._waiter is None: @@ -606,7 +608,8 @@ class SSLProtocol(protocols.Protocol): compression=sslobj.compression(), ssl_object=sslobj, ) - self._app_protocol.connection_made(self._app_transport) + if self._call_connection_made: + self._app_protocol.connection_made(self._app_transport) self._wakeup_waiter() self._session_established = True # In case transport.write() was already called. Don't call |