From 12a04e09506fc2c3fec737199110cbdd0faed190 Mon Sep 17 00:00:00 2001 From: Martin Dosch Date: Thu, 11 Apr 2024 09:50:28 +0200 Subject: [PATCH] Set shutdown earlier to further reduce probability of races. --- xmpp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmpp.go b/xmpp.go index 8b66ad4..f5a6758 100644 --- a/xmpp.go +++ b/xmpp.go @@ -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, "\n") go func() { <-time.After(10 * time.Second)