From 5502eea661670eb0524e55f5f4e1c43ffa2712e7 Mon Sep 17 00:00:00 2001 From: Scott Date: Fri, 31 Jan 2020 14:31:17 +1030 Subject: [PATCH] revid: remove Burst method's duration parameter --- cmd/rv/main.go | 3 +-- revid/revid.go | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/rv/main.go b/cmd/rv/main.go index 1013821b..419f6ae2 100644 --- a/cmd/rv/main.go +++ b/cmd/rv/main.go @@ -198,8 +198,7 @@ func run(rv *revid.Revid, ns *netsender.Sender, l *logger.Logger, nl *netlogger. continue } case modeBurst: - dur := time.Duration(rv.Config().BurstPeriod) * time.Second - err = rv.Burst(dur) + err = rv.Burst() if err != nil { l.Log(logger.Warning, pkg+"could not start burst", "error", err.Error()) ns.SetMode(modePaused, &vs) diff --git a/revid/revid.go b/revid/revid.go index cfac213c..5af91f73 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -493,7 +493,7 @@ func (r *Revid) Stop() { } // Burst starts revid, waits for time specified, and then stops revid. -func (r *Revid) Burst(duration time.Duration) error { +func (r *Revid) Burst() error { r.cfg.Logger.Log(logger.Info, pkg+"starting burst") err := r.Start() @@ -501,7 +501,9 @@ func (r *Revid) Burst(duration time.Duration) error { return fmt.Errorf("could not start revid: %w", err) } - time.Sleep(duration) + dur := time.Duration(r.cfg.BurstPeriod) * time.Second + time.Sleep(dur) + r.cfg.Logger.Log(logger.Info, pkg+"stopping burst") r.Stop() return nil