Add Close method on *XMPP.
This commit is contained in:
parent
0aac61b1cc
commit
e4acd3d349
|
|
@ -170,13 +170,14 @@ func (x *XMPP) sender() {
|
||||||
// Close the stream. Note: relies on common element name for all types of
|
// Close the stream. Note: relies on common element name for all types of
|
||||||
// XMPP connection.
|
// XMPP connection.
|
||||||
log.Println("Close XMPP stream")
|
log.Println("Close XMPP stream")
|
||||||
x.stream.SendEnd(&xml.EndElement{xml.Name{"stream", "stream"}})
|
x.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *XMPP) receiver() {
|
func (x *XMPP) receiver() {
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
log.Println("Close XMPP receiver")
|
log.Println("Close XMPP receiver")
|
||||||
|
x.Close()
|
||||||
close(x.In)
|
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.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue