summaryrefslogtreecommitdiff
path: root/xmpp.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-05-15 19:07:56 +0200
committerxengineering <me@xengineering.eu>2023-05-15 19:07:56 +0200
commitc6090c0d375f28002166a463cfc7b7cda4425626 (patch)
tree3e95cf54edc95dc03b61a558366dfff9069026be /xmpp.go
parent4c920880da47f771ad695e980f5bae807c1ac4e9 (diff)
downloadlimox-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.
Diffstat (limited to 'xmpp.go')
-rw-r--r--xmpp.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/xmpp.go b/xmpp.go
index ae38682..c432a62 100644
--- a/xmpp.go
+++ b/xmpp.go
@@ -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 {