From e4acd3d34934324d94a738f1168fe641c46c3129 Mon Sep 17 00:00:00 2001 From: Chteufleur Date: Wed, 5 Oct 2016 21:23:56 +0200 Subject: [PATCH] Add Close method on *XMPP. --- src/xmpp/xmpp.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xmpp/xmpp.go b/src/xmpp/xmpp.go index 3be89a7..0da7d81 100644 --- a/src/xmpp/xmpp.go +++ b/src/xmpp/xmpp.go @@ -170,13 +170,14 @@ func (x *XMPP) sender() { // Close the stream. Note: relies on common element name for all types of // XMPP connection. log.Println("Close XMPP stream") - x.stream.SendEnd(&xml.EndElement{xml.Name{"stream", "stream"}}) + x.Close() } func (x *XMPP) receiver() { defer func() { log.Println("Close XMPP receiver") + x.Close() close(x.In) }() @@ -220,5 +221,9 @@ func (x *XMPP) receiver() { } } -// BUG(matt): Filter channels are not closed when the stream is closed. +func (x *XMPP) Close() { + log.Println("Close XMPP") + x.stream.SendEnd(&xml.EndElement{xml.Name{"stream", "stream"}}) +} +// BUG(matt): Filter channels are not closed when the stream is closed.