diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index bcabf40d..1eafaae9 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -253,12 +253,15 @@ func handleFlags() revid.Config { func run(cfg revid.Config) error { log.Log(logger.Info, pkg+"running in NetSender mode") + var err error + var vars map[string]string + // initialize NetSender and use NetSender's logger var ns netsender.Sender if err := ns.Init(log, nil, nil, nil); err != nil { return err } - vars, _ := ns.Vars() + vars, _ = ns.Vars() vs := ns.VarSum() rv, err := revid.New(cfg, &ns) @@ -291,10 +294,10 @@ func run(cfg revid.Config) error { // If var sum hasn't change we continue if vs == ns.VarSum() { - continue + goto sleep } - vars, err := ns.Vars() + vars, err = ns.Vars() if err != nil { log.Log(logger.Error, pkg+"netSender failed to get vars", "error", err.Error()) time.Sleep(netSendRetryTime) @@ -324,6 +327,7 @@ func run(cfg revid.Config) error { } ns.SetMode(paused, &vs) } + sleep: sleepTime, _ := strconv.Atoi(ns.Param("mp")) time.Sleep(time.Duration(sleepTime) * time.Second) } diff --git a/revid/revid.go b/revid/revid.go index e4c7dbbe..d0f3abf6 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -582,6 +582,7 @@ loop: r.config.Logger.Log(logger.Error, pkg+"failed to close output"+strconv.Itoa(i)+" destination", "error", err.Error()) } } + r.wg.Done() } // startRaspivid sets up things for input from raspivid i.e. starts