From: Antoine Pitrou Date: Wed, 17 Jul 2013 13:09:05 +0000 (+0200) Subject: Crude fix for issue #855: automatically initiate SSL handshake in SSLIOStream. X-Git-Tag: v3.2.0b1~100^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f03204286fb16b801c5b69f0bad606b5ccec2e8;p=thirdparty%2Ftornado.git Crude fix for issue #855: automatically initiate SSL handshake in SSLIOStream. Perhaps this should be exposed as an option instead? --- diff --git a/tornado/iostream.py b/tornado/iostream.py index cd97f9d30..9b10dc2c8 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -801,6 +801,10 @@ class SSLIOStream(IOStream): self._handshake_writing = False self._ssl_connect_callback = None self._server_hostname = None + self._initiate_handshake() + + def _initiate_handshake(self): + self._add_io_state(self.io_loop.READ | self.io_loop.WRITE) def reading(self): return self._handshake_reading or super(SSLIOStream, self).reading() diff --git a/tornado/test/iostream_test.py b/tornado/test/iostream_test.py index 24f8eef4c..0675c4f7a 100644 --- a/tornado/test/iostream_test.py +++ b/tornado/test/iostream_test.py @@ -120,16 +120,6 @@ class TestIOStreamMixin(object): def accept_callback(connection, address): streams[0] = self._make_server_iostream(connection, **kwargs) - if isinstance(streams[0], SSLIOStream): - # HACK: The SSL handshake won't complete (and - # therefore the client connect callback won't be - # run)until the server side has tried to do something - # with the connection. For these tests we want both - # sides to connect before we do anything else with the - # connection, so we must cause some dummy activity on the - # server. If this turns out to be useful for real apps - # it should have a cleaner interface. - streams[0]._add_io_state(IOLoop.READ) self.stop() def connect_callback():