Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 409408845d8b64e4940d911c73bf5a8edba086b5 Author: Wim <wim@42.be> Date: Sat Nov 26 15:02:39 2016 +0000 Enable keepalive (xmpp) diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index f57fa51..9ec6b23 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -7819 +7826 @@ func (b *Bxmpp) createXMPP() (*xmpp.Client, error) {   return b.xc, err  }   -func (b *Bxmpp) xmppKeepAlive() { +func (b *Bxmpp) xmppKeepAlive() chan bool { + done := make(chan bool)   go func() {   ticker := time.NewTicker(90 * time.Second) + defer ticker.Stop()   for {   select {   case <-ticker.C: - b.xc.Send(xmpp.Chat{}) + b.xc.PingC2S("", "") + case <-done: + return   }   }   }() + return done  }    func (b *Bxmpp) handleXmpp() error { + done := b.xmppKeepAlive() + defer close(done)   for {   m, err := b.xc.Recv()   if err != nil {