From 8715603ce1a713d1c8841382bb965cb55948fedd Mon Sep 17 00:00:00 2001 From: xengineering Date: Mon, 26 Jun 2023 18:37:16 +0200 Subject: xmpp: Remove unused code This is part of the refactoring. Details of the old implementation should be looked up by older commits. --- xmpp/session.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'xmpp/session.go') diff --git a/xmpp/session.go b/xmpp/session.go index 2162d66..e928f01 100644 --- a/xmpp/session.go +++ b/xmpp/session.go @@ -16,8 +16,8 @@ type session struct { in, out chan any transport *tls.Conn ed encoderDecoder - streams []stream rx chan xml.Token + streamEnd xml.EndElement } func StartSession(out chan any, jid string, pwd string) chan any { @@ -26,7 +26,6 @@ func StartSession(out chan any, jid string, pwd string) chan any { s.jid = jid s.in = make(chan any) s.out = out - s.streams = make([]stream, 0) s.rx = make(chan xml.Token, 0) go s.run() @@ -82,9 +81,6 @@ func (s *session) startTransport() error { } func (s *session) openStream() { - stream := stream{} - stream.session = s - start := xml.StartElement{ xml.Name{"jabber:client", "stream:stream"}, []xml.Attr{ @@ -96,21 +92,17 @@ func (s *session) openStream() { }, } - stream.end = start.End() + s.streamEnd = start.End() err := s.ed.encodeToken(start) if err != nil { log.Println("Could not encode stream start!") } - - s.streams = append(s.streams, stream) } func (s *session) closeStreams() { - for { - limit := len(s.streams) - if limit <= 0 { break } - s.streams[limit - 1].terminate() - s.streams = s.streams[:limit - 1] + err := s.ed.encodeToken(s.streamEnd) + if err != nil { + log.Println("Could not encode stream end!") } } -- cgit v1.2.3-70-g09d2