summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-05-11 20:44:18 +0200
committerxengineering <me@xengineering.eu>2023-05-11 20:44:18 +0200
commit1c054d8f976f3f2330aaa31bf72c4584be7e35a4 (patch)
tree99bb15bf5fdc8f8be9a5f2ec390f5e70a898585b
parent03c43e5db20d4c4613ec56ee1ec4c4255398d630 (diff)
downloadlimox-1c054d8f976f3f2330aaa31bf72c4584be7e35a4.tar
limox-1c054d8f976f3f2330aaa31bf72c4584be7e35a4.tar.zst
limox-1c054d8f976f3f2330aaa31bf72c4584be7e35a4.zip
Further refactoring with the defer statement
-rw-r--r--xmpp.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/xmpp.go b/xmpp.go
index 89be5a9..5f1d1f9 100644
--- a/xmpp.go
+++ b/xmpp.go
@@ -28,6 +28,7 @@ func (l *Limox) xmpp(jid string, pwd string) {
receiver := make(chan xml.Token)
termination := make(chan bool)
go rxRoutine(conn, receiver, termination)
+ defer func() { termination <- true }()
enc := xml.NewEncoder(conn)
dbg := xml.NewEncoder(os.Stdout)
@@ -42,7 +43,6 @@ func (l *Limox) xmpp(jid string, pwd string) {
case ev := <-l.GuiEvents:
switch ev {
case Disconnect:
- termination <- true
return
default:
log.Fatalf("Unknown GuiEvent '%d'!\n", ev)