diff options
author | xengineering <me@xengineering.eu> | 2023-07-03 22:17:15 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-07-03 22:17:15 +0200 |
commit | 2fade1039c1842f08b30da5c95b5542b57e38ec6 (patch) | |
tree | 329ae6641f6b00f1e0cbf65321ac44b90d0c15e4 /xmpp/session.go | |
parent | cf520b079743ec95d085a439d00b841c253c564a (diff) | |
download | limox-2fade1039c1842f08b30da5c95b5542b57e38ec6.tar limox-2fade1039c1842f08b30da5c95b5542b57e38ec6.tar.zst limox-2fade1039c1842f08b30da5c95b5542b57e38ec6.zip |
Move xml.Encoder to session struct
The encoderDecoder sub-struct of the session struct should be removed in
little steps. This is the first one.
Diffstat (limited to 'xmpp/session.go')
-rw-r--r-- | xmpp/session.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/xmpp/session.go b/xmpp/session.go index a43e4f4..b4a8fab 100644 --- a/xmpp/session.go +++ b/xmpp/session.go @@ -4,6 +4,7 @@ import ( "crypto/tls" "crypto/x509" "encoding/xml" + "io" "log" ) @@ -18,6 +19,7 @@ type session struct { out chan<- any transport *tls.Conn ed encoderDecoder + tx *xml.Encoder rx chan xml.Token resourceReq string } @@ -49,6 +51,10 @@ func (s *session) run() { go s.ed.run() defer func() { s.ed.terminator <- true }() + lw := logger{"[TX] "} + w := io.MultiWriter(s.transport, lw) + s.tx = xml.NewEncoder(w) + s.out <- SessionConnect{} runStreamPair(s) |