File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,8 @@ const (
8282
8383 FAST = x .WGFAST
8484
85- refreshInterval = 2 * time .Minute
85+ refreshInterval = 2 * time .Minute // refresh interval between onNotOKs
86+ minRefreshInterval = 5 * time .Second // hard refresh interval; roughly one re-send handshake timeout
8687
8788 noviaid = ""
8889)
@@ -362,7 +363,13 @@ func (w *wgproxy) Refresh() (err error) {
362363 // TODO: skip on s == TUP?
363364 if w .tooyoung () {
364365 log .VV ("proxy: wg: %s refresh skipped; too young; status(%s)" , w .tag (), pxstatus (status ))
365- return
366+ return // TODO: err?
367+ }
368+
369+ lastRefresh := w .latestRefresh .Load ()
370+ if now ()- lastRefresh < minRefreshInterval .Milliseconds () {
371+ log .VV ("proxy: wg: %s refresh skipped; done recently; status(%s)" , w .tag (), pxstatus (status ))
372+ return // TODO: err?
366373 }
367374
368375 w .latestRefresh .Store (now ())
You can’t perform that action at this time.
0 commit comments