xmpp_transport: Reset encryption status when initiating new connection

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.
This commit is contained in:
Matthew Wild
2025-10-09 10:11:59 +01:00
committed by Mickaël Rémond
parent 784ff58cc2
commit 7df984516d
+3
View File
@@ -35,6 +35,9 @@ var clientStreamOpen = fmt.Sprintf("<?xml version='1.0'?><stream:stream to='%%s'
func (t *XMPPTransport) Connect() (string, error) {
var err error
// Since we're starting a new connection, reset the encryption status
t.isSecure = false
t.conn, err = net.DialTimeout("tcp", t.Config.Address, time.Duration(t.Config.ConnectTimeout)*time.Second)
if err != nil {
return "", NewConnError(err, true)