Defer closing of xmpp connection.

This commit is contained in:
Martin Dosch 2023-07-29 10:27:28 +02:00
parent acb758c982
commit feaa866e0e
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

View File

@ -446,7 +446,7 @@ func main() {
signal.Notify(c, os.Interrupt)
go func() {
for range c {
client.Close()
defer client.Close()
os.Exit(0)
}
}()
@ -613,5 +613,5 @@ func main() {
// Wait for a short time as some messages are not delivered by the server
// if the connection is closed immediately after sending a message.
time.Sleep(defaultSleepTime * time.Millisecond)
client.Close()
defer client.Close()
}