From b7bac3d11871abae211a15acdaf48d8abc9830ef Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Wed, 28 Jan 2015 13:51:04 +0000 Subject: [PATCH] workaround for goexmpp bug --- go/r3-netstatus/main.go | 2 +- go/r3-netstatus/r3xmppbot/r3xmppbot.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/go/r3-netstatus/main.go b/go/r3-netstatus/main.go index 23bcce0..34336b0 100644 --- a/go/r3-netstatus/main.go +++ b/go/r3-netstatus/main.go @@ -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) } } diff --git a/go/r3-netstatus/r3xmppbot/r3xmppbot.go b/go/r3-netstatus/r3xmppbot/r3xmppbot.go index 177f4a1..2d797fd 100644 --- a/go/r3-netstatus/r3xmppbot/r3xmppbot.go +++ b/go/r3-netstatus/r3xmppbot/r3xmppbot.go @@ -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 { -- 1.7.10.4