diff options
author | xengineering <me@xengineering.eu> | 2023-05-15 19:07:56 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-05-15 19:07:56 +0200 |
commit | c6090c0d375f28002166a463cfc7b7cda4425626 (patch) | |
tree | 3e95cf54edc95dc03b61a558366dfff9069026be | |
parent | 4c920880da47f771ad695e980f5bae807c1ac4e9 (diff) | |
download | limox-c6090c0d375f28002166a463cfc7b7cda4425626.tar limox-c6090c0d375f28002166a463cfc7b7cda4425626.tar.zst limox-c6090c0d375f28002166a463cfc7b7cda4425626.zip |
Move disconnect announcement closer to connect
This keeps the two strongly related actions to one block of code which
improves readability and might avoid some bugs.
-rw-r--r-- | xmpp.go | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -16,8 +16,6 @@ const ( ) func xmpp(rxChan chan GuiEvent, txChan chan any, jid string, pwd string) { - defer func() { txChan <- XmppDisconnect }() - conn, err := setupConn(jid) if err != nil { log.Print(err) @@ -39,6 +37,7 @@ func xmpp(rxChan chan GuiEvent, txChan chan any, jid string, pwd string) { defer sendStreamEnd(enc, dbg, end) txChan <- XmppConnect + defer func() { txChan <- XmppDisconnect }() for { select { |