diff options
| author | xengineering <me@xengineering.eu> | 2023-07-03 14:04:19 +0200 |
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2023-07-03 14:04:19 +0200 |
| commit | 8df0398af97f2f9e782f4f5581ea5f4db236710d (patch) | |
| tree | 53286da2739ae794ce7d420bb913a93139961880 | |
| parent | 322e2c5f24c830282dbd66adbb95a7acf1255c9a (diff) | |
| parent | 58aecc9d860a18767aa51d0d94793057e1aa57e2 (diff) | |
| download | limox-8df0398af97f2f9e782f4f5581ea5f4db236710d.tar limox-8df0398af97f2f9e782f4f5581ea5f4db236710d.tar.zst limox-8df0398af97f2f9e782f4f5581ea5f4db236710d.zip | |
Merge branch 'fix-btn-callback-race'
This fixes a race condition which was discovered during testing with a
bad network connection. Good network connections seem to hide this
error.
| -rw-r--r-- | limox.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -80,6 +80,7 @@ func (l *Limox) run() error { } func (l *Limox) buttonCallback() { + c := l.sessionIn switch l.State { case Disconnected: jid := l.JidEditor.Text() @@ -89,10 +90,10 @@ func (l *Limox) buttonCallback() { l.sessionIn = xmpp.StartSession(l.sessionOut, jid, pwd) l.State = Connecting case Connecting: - go func() { l.sessionIn <- xmpp.SessionShouldDisconnect{} }() + go func() { c <- xmpp.SessionShouldDisconnect{} }() l.State = Disconnected case Connected: - go func() { l.sessionIn <- xmpp.SessionShouldDisconnect{} }() + go func() { c <- xmpp.SessionShouldDisconnect{} }() l.State = Disconnected } } |
