workaround for goexmpp bug
authorBernhard Tittelbach <xro@realraum.at>
Wed, 28 Jan 2015 13:51:04 +0000 (13:51 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Wed, 28 Jan 2015 13:51:04 +0000 (13:51 +0000)
go/r3-netstatus/main.go
go/r3-netstatus/r3xmppbot/r3xmppbot.go

index 23bcce0..34336b0 100644 (file)
@@ -182,7 +182,7 @@ func RunXMPPBot(ps *pubsub.PubSub, zmqctx *zmq.Context) {
                } else {
                        Syslog_.Printf("Error starting XMPP Bot: %s", xmpperr.Error())
                }
-               time.Sleep(10 * time.Second)
+               time.Sleep(20 * time.Second)
        }
 }
 
index 177f4a1..2d797fd 100644 (file)
@@ -5,6 +5,7 @@ package r3xmppbot
 import (
        "crypto/tls"
        "encoding/json"
+       "errors"
        "os"
        "path"
        "strings"
@@ -445,6 +446,10 @@ func NewStartedBot(loginjid, loginpwd, password, state_save_dir string, insecure
                Syslog_.Println("Error connecting to xmpp server", err)
                return nil, nil, err
        }
+       if botdata.xmppclient_ == nil {
+               Syslog_.Println("xmpp.NewClient returned nil without error")
+               return nil, nil, errors.New("No answer from xmpp server")
+       }
 
        err = botdata.xmppclient_.StartSession(true, &xmpp.Presence{})
        if err != nil {