diff options
author | xengineering <me@xengineering.eu> | 2023-06-27 16:05:58 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-06-27 16:05:58 +0200 |
commit | 35a9c27783524a035ab6545061f5ecd5fdee6ea7 (patch) | |
tree | a6d932f7fbb0c26adf88971b419f23032a7805af | |
parent | 8ae8609656959763f19c1974753f5172b7603cd0 (diff) | |
download | limox-35a9c27783524a035ab6545061f5ecd5fdee6ea7.tar limox-35a9c27783524a035ab6545061f5ecd5fdee6ea7.tar.zst limox-35a9c27783524a035ab6545061f5ecd5fdee6ea7.zip |
xmpp: StartSession(): Switch to directed chan
This reduces the risk of using those channels wrong.
-rw-r--r-- | limox.go | 2 | ||||
-rw-r--r-- | xmpp/session.go | 5 |
2 files changed, 4 insertions, 3 deletions
@@ -26,7 +26,7 @@ type Limox struct { JidEditor widget.Editor PwdEditor widget.Editor MainButton widget.Clickable - sessionIn chan any + sessionIn chan<- any sessionOut chan any State LimoxState Window *app.Window diff --git a/xmpp/session.go b/xmpp/session.go index 1bd9bd5..88a01ae 100644 --- a/xmpp/session.go +++ b/xmpp/session.go @@ -13,14 +13,15 @@ type SessionShouldDisconnect struct{} type session struct { jid string - in, out chan any + in chan any + out chan<- any transport *tls.Conn ed encoderDecoder rx chan xml.Token streamEnd xml.EndElement } -func StartSession(out chan any, jid string, pwd string) (in chan any) { +func StartSession(out chan<- any, jid string, pwd string) (in chan<- any) { s := session{} s.jid = jid |