mirror of https://bitbucket.org/ausocean/av.git
NetReceiver vars updating again. sendTo() now takes a *netsender.Sender.
This commit is contained in:
parent
5ba5327f33
commit
82f58ec996
|
@ -250,8 +250,6 @@ func main() {
|
||||||
l.Log(progName, "Error", err.Error()) // TODO(kortschak): Make this "Fatal" when that exists.
|
l.Log(progName, "Error", err.Error()) // TODO(kortschak): Make this "Fatal" when that exists.
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
vs = ns.GetVarSum()
|
|
||||||
} else {
|
} else {
|
||||||
// alternatively, instantiate our own logger
|
// alternatively, instantiate our own logger
|
||||||
config.Logger = smartlogger.New(loggerVerbosity, smartlogger.File, "/var/log/netsender/")
|
config.Logger = smartlogger.New(loggerVerbosity, smartlogger.File, "/var/log/netsender/")
|
||||||
|
@ -263,8 +261,8 @@ func main() {
|
||||||
|
|
||||||
// loop in NetSender mode
|
// loop in NetSender mode
|
||||||
for *useNetsender {
|
for *useNetsender {
|
||||||
if err := sendTo(ns); err != nil {
|
if err := sendTo(&ns); err != nil {
|
||||||
config.Logger.Log(progName, "Error", err.Error())
|
config.Logger.Log(progName, "Warning", err.Error())
|
||||||
time.Sleep(netSendRetryTime)
|
time.Sleep(netSendRetryTime)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -273,7 +271,7 @@ func main() {
|
||||||
// vars changed
|
// vars changed
|
||||||
vars, err := ns.Vars()
|
vars, err := ns.Vars()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
config.Logger.Log(progName, "Error", err.Error())
|
config.Logger.Log(progName, "Warning", err.Error())
|
||||||
time.Sleep(netSendRetryTime)
|
time.Sleep(netSendRetryTime)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -301,15 +299,9 @@ func main() {
|
||||||
stopRevid()
|
stopRevid()
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendTo handles NetReceiver configuration and sends requested data to the cloud.
|
// sendTo implements our main NetSender client and handles NetReceiver configuration
|
||||||
func sendTo(ns netsender.Sender) error {
|
// (as distinct from httpSender which just sends video data).
|
||||||
if !ns.IsConfigured() {
|
func sendTo(ns *netsender.Sender) error {
|
||||||
err := ns.Config()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// populate input values, if any
|
// populate input values, if any
|
||||||
inputs := netsender.MakePins(ns.GetConfigParam("ip"))
|
inputs := netsender.MakePins(ns.GetConfigParam("ip"))
|
||||||
for i, pin := range inputs {
|
for i, pin := range inputs {
|
||||||
|
|
Loading…
Reference in New Issue