diff --git a/client.go b/client.go index 9969472..0a29605 100644 --- a/client.go +++ b/client.go @@ -296,7 +296,11 @@ func (c *Client) Resume() error { // Disconnect disconnects the client from the server, sending a stream close nonza and closing the TCP connection. func (c *Client) Disconnect() error { if c.transport != nil { - return c.transport.Close() + err := c.transport.Close() + if c.Session != nil { + c.disconnected(c.Session.SMState) + } + return err } // No transport so no connection. return nil @@ -411,7 +415,8 @@ func (c *Client) recv(keepaliveQuit chan<- struct{}) { case stanza.StreamClosePacket: // TCP messages should arrive in order, so we can expect to get nothing more after this occurs c.transport.ReceivedStreamClose() - return + c.Disconnect() + continue default: c.Session.SMState.Inbound++ } diff --git a/xmpp_transport.go b/xmpp_transport.go index 9e7cb21..c7d2022 100644 --- a/xmpp_transport.go +++ b/xmpp_transport.go @@ -35,12 +35,15 @@ var clientStreamOpen = fmt.Sprintf("