From 0f96bb37005dfda8c2fe20a638f670f6385d2e8b Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 18 May 2023 18:35:53 +0200 Subject: Use one bidirectional channel for communication --- xmpp/xmpp.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'xmpp') 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 -- cgit v1.2.3-70-g09d2