mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2026-07-03 05:54:03 -07:00
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:
committed by
Mickaël Rémond
parent
784ff58cc2
commit
7df984516d
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user