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
if c.Session, err = NewSession(c.transport, c.config, state); err != nil {
c.transport.Close()
return err
}
c.Session.StreamId = streamId