From 1c054d8f976f3f2330aaa31bf72c4584be7e35a4 Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 11 May 2023 20:44:18 +0200 Subject: Further refactoring with the defer statement --- xmpp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3-70-g09d2