Repository navigation
Conversation
… lost SSLProtocol.connection_lost() did not notify the application protocol while a handshake was in progress, even when start_tls() had handed over a protocol that had already seen connection_made(). With streams this left StreamWriter.wait_closed() waiting forever.
gpshead
marked this pull request as ready for review
October 23, 2026 21:51
gpshead
requested review from
1st1,
asvetlov,
kumaraditya303,
picnixz and
willingc
as code owners
October 23, 2026 21:51
| self.loop.start_tls(tr, proto, client_context), | ||
| 0.5) | ||
|
|
||
| self.assertIsNone(await on_con_lost) |
Contributor
There was a problem hiding this comment.
this should have timeout as well, otherwise it will hang forever.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SSLProtocol.connection_lost()did not forward to the application protocol while the handshake was in progress. That is right forcreate_connection(ssl=...)andcreate_server(ssl=...), where the protocol has not hadconnection_made()yet, but not forstart_tls(), where it has. The method now decides on the application protocol state alone, which already tells the two cases apart (STATE_INITvs.STATE_CON_MADE). After a connection reset, a handshake timeout or a cancelledstart_tls()the protocol now getsconnection_lost(), andStreamWriter.wait_closed()completes instead of waiting forever.A protocol passed to
start_tls()now gets aconnection_lost()call in these cases that it did not get before (withNonewhenstart_tls()was cancelled); that is the documented contract. The reset test accepts anyConnectionErrorbecause it was only run on selector event loops.Fixes #160513
ANT-2026-A6ZIAFVT ANT-2026-4SKWM05E
start_tls()does not callconnection_lost()when the handshake is aborted #160513