Set shutdown earlier to further reduce probability of races.

This commit is contained in:
Martin Dosch 2024-04-11 09:50:28 +02:00
parent 2f331ed19c
commit 12a04e0950

View File

@ -370,8 +370,8 @@ func NewClientNoTLS(host, user, passwd string, debug bool) (*Client, error) {
// Close closes the XMPP connection
func (c *Client) Close() error {
c.shutdown = true
if c.conn != (*tls.Conn)(nil) {
c.shutdown = true
fmt.Fprintf(c.stanzaWriter, "</stream:stream>\n")
go func() {
<-time.After(10 * time.Second)