summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/sslproto.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-05-29 09:19:09 (GMT)
committerGitHub <noreply@github.com>2018-05-29 09:19:09 (GMT)
commitbe5d616e5529a1388a0b451bf6a65ad5bdb70d29 (patch)
treecdc131d0b5830ec05f39715620072e62866ee793 /Lib/asyncio/sslproto.py
parent2641ee5040abb090e66e4ff80c33b76729b36e75 (diff)
downloadcpython-be5d616e5529a1388a0b451bf6a65ad5bdb70d29.zip
cpython-be5d616e5529a1388a0b451bf6a65ad5bdb70d29.tar.gz
cpython-be5d616e5529a1388a0b451bf6a65ad5bdb70d29.tar.bz2
bpo-33654: Support protocol type switching in SSLTransport.set_protocol() (GH-7194)
(cherry picked from commit 2179022d94937d7b0600b0dc192ca6fa5f53d830) Co-authored-by: Yury Selivanov <yury@magic.io>
Diffstat (limited to 'Lib/asyncio/sslproto.py')
-rw-r--r--Lib/asyncio/sslproto.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index ab43e93..a6d382e 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -295,7 +295,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin,
return self._ssl_protocol._get_extra_info(name, default)
def set_protocol(self, protocol):
- self._ssl_protocol._app_protocol = protocol
+ self._ssl_protocol._set_app_protocol(protocol)
def get_protocol(self):
return self._ssl_protocol._app_protocol
@@ -440,9 +440,7 @@ class SSLProtocol(protocols.Protocol):
self._waiter = waiter
self._loop = loop
- self._app_protocol = app_protocol
- self._app_protocol_is_buffer = \
- isinstance(app_protocol, protocols.BufferedProtocol)
+ self._set_app_protocol(app_protocol)
self._app_transport = _SSLProtocolTransport(self._loop, self)
# _SSLPipe instance (None until the connection is made)
self._sslpipe = None
@@ -454,6 +452,11 @@ class SSLProtocol(protocols.Protocol):
self._call_connection_made = call_connection_made
self._ssl_handshake_timeout = ssl_handshake_timeout
+ def _set_app_protocol(self, app_protocol):
+ self._app_protocol = app_protocol
+ self._app_protocol_is_buffer = \
+ isinstance(app_protocol, protocols.BufferedProtocol)
+
def _wakeup_waiter(self, exc=None):
if self._waiter is None:
return