Close stream before closing connection.

This commit is contained in:
Martin Dosch 2024-02-25 12:25:57 +01:00
parent b7ea9f4be1
commit 9684a8ff69

View File

@ -330,6 +330,7 @@ func NewClientNoTLS(host, user, passwd string, debug bool) (*Client, error) {
// Close closes the XMPP connection
func (c *Client) Close() error {
if c.conn != (*tls.Conn)(nil) {
fmt.Fprintf(c.stanzaWriter, "</stream:stream>\n")
return c.conn.Close()
}
return nil