diff options
author | xengineering <me@xengineering.eu> | 2023-05-18 18:35:53 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-05-18 18:35:53 +0200 |
commit | 0f96bb37005dfda8c2fe20a638f670f6385d2e8b (patch) | |
tree | 616d70cc2127bc0c16235aff4b4fa1c44a20fe69 /xmpp | |
parent | c5cd3e4eafb4fdd10c9bfe0ccac0993beb20f3ee (diff) | |
download | limox-0f96bb37005dfda8c2fe20a638f670f6385d2e8b.tar limox-0f96bb37005dfda8c2fe20a638f670f6385d2e8b.tar.zst limox-0f96bb37005dfda8c2fe20a638f670f6385d2e8b.zip |
Use one bidirectional channel for communication
Diffstat (limited to 'xmpp')
-rw-r--r-- | xmpp/xmpp.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xmpp/xmpp.go b/xmpp/xmpp.go index 5be12c4..5d5e9a3 100644 --- a/xmpp/xmpp.go +++ b/xmpp/xmpp.go @@ -16,7 +16,7 @@ const ( ShouldDisconnectEvent ) -func Run(rxChan chan Event, txChan chan any, jid string, pwd string) { +func Run(ch chan any, jid string, pwd string) { conn, err := setupConn(jid) if err != nil { log.Print(err) @@ -36,12 +36,12 @@ func Run(rxChan chan Event, txChan chan any, jid string, pwd string) { end := sendStreamStart(enc, dbg, jid) defer sendStreamEnd(enc, dbg, end) - txChan <- ConnectEvent - defer func() { txChan <- DisconnectEvent }() + ch <- ConnectEvent + defer func() { ch <- DisconnectEvent }() for { select { - case ev := <-rxChan: + case ev := <-ch: switch ev { case ShouldDisconnectEvent: return |