Skip to content

make tls handshake respect context cancelation - #782

Open
prybintsev wants to merge 1 commit into
quickfixgo:mainfrom
prybintsev:tlscon-with-context
Open

prybintsev wants to merge 1 commit into
quickfixgo:mainfrom
prybintsev:tlscon-with-context

Conversation

@prybintsev

@prybintsev prybintsev commented Oct 2, 2026 •

Copy link
Copy Markdown

Initiator.handleConnection dials with a context that is cancelled when the initiator stops,
but then calls tlsConn.Handshake(), which ignores it. If the peer accepts the TCP
connection but never completes the handshake, Initiator.Stop() blocks until the OS drops
the connection: minutes on a blackholed network, or indefinitely if the peer keeps the TCP
connection alive.

Using HandshakeContext(ctx) makes Stop cancel a pending handshake, just as it already
cancels the dial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant