Skip to content

Conversation

mwild1
Copy link

@mwild1 mwild1 commented Oct 9, 2025

This PR includes multiple small fixes go-xmpp to successfully reconnect when the server sends a </stream:stream>.

mwild1 added 4 commits October 9, 2025 10:11
If the transport has been previously connected, the isSecure flag may still
be set from a previous connection. This can lead to not negotiating TLS on the
new connection. In practice this caused a stream error, because the post-TLS
stream reset was still sent unconditionally.

This change makes reconnecting a transport negotiate TLS successfully.
closeChan is used to communicate that a stream close has been received.

In the case where the client initiates the stream closure, this works:

1) client sends stream close
2) client reads from closeChan, waiting for the server's stream close

In the case where the server initiates the stream closure, it failed:

1) transport writes to closeChan
x) client is not waiting on closeChan, so the write blocks and transport hangs

This change allows up to one event to be written asynchronously to closeChan.
After the client is notified about the disconnection, it will read from
closeChan as in the client-initiated flow but will simply find the stream
close already there.
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