From 82f58ec99686b93e349344d0d269940244a4d192 Mon Sep 17 00:00:00 2001 From: Alan Noble Date: Fri, 15 Jun 2018 17:29:59 +0930 Subject: [PATCH] NetReceiver vars updating again. sendTo() now takes a *netsender.Sender. --- cmd/revid-cli/main.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 73aef423..6d63c381 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -250,8 +250,6 @@ func main() { l.Log(progName, "Error", err.Error()) // TODO(kortschak): Make this "Fatal" when that exists. os.Exit(1) } - - vs = ns.GetVarSum() } else { // alternatively, instantiate our own logger config.Logger = smartlogger.New(loggerVerbosity, smartlogger.File, "/var/log/netsender/") @@ -263,8 +261,8 @@ func main() { // loop in NetSender mode for *useNetsender { - if err := sendTo(ns); err != nil { - config.Logger.Log(progName, "Error", err.Error()) + if err := sendTo(&ns); err != nil { + config.Logger.Log(progName, "Warning", err.Error()) time.Sleep(netSendRetryTime) continue } @@ -273,7 +271,7 @@ func main() { // vars changed vars, err := ns.Vars() if err != nil { - config.Logger.Log(progName, "Error", err.Error()) + config.Logger.Log(progName, "Warning", err.Error()) time.Sleep(netSendRetryTime) continue } @@ -301,15 +299,9 @@ func main() { stopRevid() } -// sendTo handles NetReceiver configuration and sends requested data to the cloud. -func sendTo(ns netsender.Sender) error { - if !ns.IsConfigured() { - err := ns.Config() - if err != nil { - return err - } - } - +// sendTo implements our main NetSender client and handles NetReceiver configuration +// (as distinct from httpSender which just sends video data). +func sendTo(ns *netsender.Sender) error { // populate input values, if any inputs := netsender.MakePins(ns.GetConfigParam("ip")) for i, pin := range inputs {