[Python-checkins] cpython (3.4): Issue #22560: Fix SSLProtocol._on_handshake_complete()

victor.stinner python-checkins at python.org
Thu Jan 15 09:42:26 CET 2015


https://hg.python.org/cpython/rev/fb3761de0d3c
changeset:   94162:fb3761de0d3c
branch:      3.4
parent:      94160:6ab2575bc12b
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Jan 15 09:41:48 2015 +0100
summary:
  Issue #22560: Fix SSLProtocol._on_handshake_complete()

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.

files:
  Lib/asyncio/sslproto.py |  8 ++++++--
  1 files changed, 6 insertions(+), 2 deletions(-)


diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -572,8 +572,12 @@
             # 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.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list