]> granicus.if.org Git - python/commitdiff
Issue #22560: Fix SSLProtocol._on_handshake_complete()
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 15 Jan 2015 08:41:48 +0000 (09:41 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 15 Jan 2015 08:41:48 +0000 (09:41 +0100)
Don't call immediatly self._process_write_backlog() but schedule the call using
call_soon(). _on_handshake_complete() can be called indirectly from
_process_write_backlog(), and _process_write_backlog() is not reentrant.

Lib/asyncio/sslproto.py

index 541e252774eb007877d15bf67abe263d57bb994d..31eab51ca1778ee4c82c58f1c4419360a40263a9 100644 (file)
@@ -572,8 +572,12 @@ class SSLProtocol(protocols.Protocol):
             # wait until protocol.connection_made() has been called
             self._waiter._set_result_unless_cancelled(None)
         self._session_established = True
-        # In case transport.write() was already called
-        self._process_write_backlog()
+        # In case transport.write() was already called. Don't call
+        # immediatly _process_write_backlog(), but schedule it:
+        # _on_handshake_complete() can be called indirectly from
+        # _process_write_backlog(), and _process_write_backlog() is not
+        # reentrant.
+        self._loop.call(self._process_write_backlog)
 
     def _process_write_backlog(self):
         # Try to make progress on the write backlog.