summaryrefslogtreecommitdiff
path: root/xmpp/session.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-06-16 17:06:20 +0200
committerxengineering <me@xengineering.eu>2023-06-16 17:12:09 +0200
commitae8d61bee60a29e2bbfc9cfbb400d8451d00de11 (patch)
tree5a7cec2b0195ac41ba8a6d33ece45804bb2ff29a /xmpp/session.go
parent2d9864426272055151c42cf6bc2d13fbe11ca50c (diff)
downloadlimox-ae8d61bee60a29e2bbfc9cfbb400d8451d00de11.tar
limox-ae8d61bee60a29e2bbfc9cfbb400d8451d00de11.tar.zst
limox-ae8d61bee60a29e2bbfc9cfbb400d8451d00de11.zip
Add chan xml.Token xmpp.session.rx
This allows the goroutine which fetches all tokens from the server to forward them to the main goroutine of the session.
Diffstat (limited to 'xmpp/session.go')
-rw-r--r--xmpp/session.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/xmpp/session.go b/xmpp/session.go
index 080fb21..2162d66 100644
--- a/xmpp/session.go
+++ b/xmpp/session.go
@@ -17,6 +17,7 @@ type session struct {
transport *tls.Conn
ed encoderDecoder
streams []stream
+ rx chan xml.Token
}
func StartSession(out chan any, jid string, pwd string) chan any {
@@ -26,6 +27,7 @@ func StartSession(out chan any, jid string, pwd string) chan any {
s.in = make(chan any)
s.out = out
s.streams = make([]stream, 0)
+ s.rx = make(chan xml.Token, 0)
go s.run()
@@ -55,6 +57,8 @@ func (s *session) run() {
case SessionShouldDisconnect: return
default: log.Printf("Unknown data '%d'!\n", data)
}
+ case _ = <-s.rx:
+ // TODO route received XML token here
}
}
}