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 // Close closes the XMPP connection
func (c *Client) Close() error { func (c *Client) Close() error {
if c.conn != (*tls.Conn)(nil) {
c.shutdown = true c.shutdown = true
if c.conn != (*tls.Conn)(nil) {
fmt.Fprintf(c.stanzaWriter, "</stream:stream>\n") fmt.Fprintf(c.stanzaWriter, "</stream:stream>\n")
go func() { go func() {
<-time.After(10 * time.Second) <-time.After(10 * time.Second)