Close the transport if NewSession fails

The makes sure we always send the `</stream:stream>` or `<close/>` correctly.
This commit is contained in:
Wichert Akkerman 2019-10-21 10:16:45 +02:00 committed by Mickaël Rémond
parent a6709a1f71
commit 60e2cdd088

View File

@ -173,6 +173,7 @@ func (c *Client) Resume(state SMState) error {
// Client is ok, we now open XMPP session // Client is ok, we now open XMPP session
if c.Session, err = NewSession(c.transport, c.config, state); err != nil { if c.Session, err = NewSession(c.transport, c.config, state); err != nil {
c.transport.Close()
return err return err
} }
c.Session.StreamId = streamId c.Session.StreamId = streamId