diff options
author | xengineering <me@xengineering.eu> | 2023-05-11 21:04:04 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-05-11 21:07:32 +0200 |
commit | 5d62378683a516f9e12b0190b46dae475b83e0f5 (patch) | |
tree | 1691fb33c8086d34d0678b83cf6e7f40ef2b7775 | |
parent | 1c054d8f976f3f2330aaa31bf72c4584be7e35a4 (diff) | |
download | limox-5d62378683a516f9e12b0190b46dae475b83e0f5.tar limox-5d62378683a516f9e12b0190b46dae475b83e0f5.tar.zst limox-5d62378683a516f9e12b0190b46dae475b83e0f5.zip |
Do not share memory between limox and xmpp
-rw-r--r-- | limox.go | 2 | ||||
-rw-r--r-- | xmpp.go | 10 |
2 files changed, 6 insertions, 6 deletions
@@ -86,7 +86,7 @@ func (l *Limox) buttonCallback() { switch l.State { case Disconnected: log.Println("Starting connection establishment ...") - go l.xmpp(l.JidEditor.Text(), l.PwdEditor.Text()) + go xmpp(l.GuiEvents, l.XmppEvents, l.JidEditor.Text(), l.PwdEditor.Text()) l.State = Connecting case Connecting: log.Println("Aborted connection establishment") @@ -15,12 +15,12 @@ const ( XmppConnect ) -func (l *Limox) xmpp(jid string, pwd string) { - defer func() { l.XmppEvents <- XmppDisconnect }() +func xmpp(rxChan chan GuiEvent, txChan chan any, jid string, pwd string) { + defer func() { txChan <- XmppDisconnect }() conn, err := setupConn(jid) if err != nil { - l.XmppEvents <- err + txChan <- err return } defer conn.Close() @@ -36,11 +36,11 @@ func (l *Limox) xmpp(jid string, pwd string) { end := sendStreamStart(enc, jid) defer sendStreamEnd(enc, end) - l.XmppEvents <- XmppConnect + txChan <- XmppConnect for { select { - case ev := <-l.GuiEvents: + case ev := <-rxChan: switch ev { case Disconnect: return |