Created
October 11, 2018 02:13
-
-
Save fantix/d3135195bc3a51d11e53225a78f3ff85 to your computer and use it in GitHub Desktop.
#203 create transport only once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/uvloop/sslproto.pxd b/uvloop/sslproto.pxd | |
index 30efa5c..e3f79a2 100644 | |
--- a/uvloop/sslproto.pxd | |
+++ b/uvloop/sslproto.pxd | |
@@ -27,6 +27,7 @@ cdef class SSLProtocol: | |
object _waiter | |
object _loop | |
_SSLProtocolTransport _app_transport | |
+ bint _app_transport_created | |
object _transport | |
bint _call_connection_made | |
diff --git a/uvloop/sslproto.pyx b/uvloop/sslproto.pyx | |
index ab02252..82b0015 100644 | |
--- a/uvloop/sslproto.pyx | |
+++ b/uvloop/sslproto.pyx | |
@@ -250,6 +250,7 @@ cdef class SSLProtocol: | |
self._loop = loop | |
self._set_app_protocol(app_protocol) | |
self._app_transport = None | |
+ self._app_transport_created = False | |
# transport, ex: SelectorSocketTransport | |
self._transport = None | |
self._call_connection_made = call_connection_made | |
@@ -303,7 +304,10 @@ cdef class SSLProtocol: | |
def _get_app_transport(self): | |
if self._app_transport is None: | |
+ if self._app_transport_created: | |
+ raise RuntimeError('Creating _SSLProtocolTransport twice') | |
self._app_transport = _SSLProtocolTransport(self._loop, self) | |
+ self._app_transport_created = True | |
return self._app_transport | |
def connection_made(self, transport): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment