mirror of
https://github.com/juanfont/headscale.git
synced 2025-02-01 07:11:23 +09:00
fix panic if derp update is 0 (#2368)
Some checks failed
Build / build-cross (GOARCH=arm64 GOOS=darwin) (push) Has been cancelled
Build / build-nix (push) Has been cancelled
Build / build-cross (GOARCH=386 GOOS=linux) (push) Has been cancelled
Build / build-cross (GOARCH=amd64 GOOS=darwin) (push) Has been cancelled
Build / build-cross (GOARCH=amd64 GOOS=linux) (push) Has been cancelled
Build / build-cross (GOARCH=arm GOOS=linux GOARM=5) (push) Has been cancelled
Build / build-cross (GOARCH=arm GOOS=linux GOARM=6) (push) Has been cancelled
Build / build-cross (GOARCH=arm GOOS=linux GOARM=7) (push) Has been cancelled
Build / build-cross (GOARCH=arm64 GOOS=linux) (push) Has been cancelled
Tests / test (push) Has been cancelled
Some checks failed
Build / build-cross (GOARCH=arm64 GOOS=darwin) (push) Has been cancelled
Build / build-nix (push) Has been cancelled
Build / build-cross (GOARCH=386 GOOS=linux) (push) Has been cancelled
Build / build-cross (GOARCH=amd64 GOOS=darwin) (push) Has been cancelled
Build / build-cross (GOARCH=amd64 GOOS=linux) (push) Has been cancelled
Build / build-cross (GOARCH=arm GOOS=linux GOARM=5) (push) Has been cancelled
Build / build-cross (GOARCH=arm GOOS=linux GOARM=6) (push) Has been cancelled
Build / build-cross (GOARCH=arm GOOS=linux GOARM=7) (push) Has been cancelled
Build / build-cross (GOARCH=arm64 GOOS=linux) (push) Has been cancelled
Tests / test (push) Has been cancelled
* fix panic if derp update is 0 Fixes #2362 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> * update changelog Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> --------- Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
9e3f945eda
commit
d1dbe4ece9
2 changed files with 8 additions and 6 deletions
|
@ -17,6 +17,8 @@
|
||||||
[#2364](https://github.com/juanfont/headscale/pull/2364)
|
[#2364](https://github.com/juanfont/headscale/pull/2364)
|
||||||
- Remove invalid routes and add stronger constraints for routes to avoid API panic
|
- Remove invalid routes and add stronger constraints for routes to avoid API panic
|
||||||
[#2371](https://github.com/juanfont/headscale/pull/2371)
|
[#2371](https://github.com/juanfont/headscale/pull/2371)
|
||||||
|
- Fix panic when `derp.update_frequency` is 0
|
||||||
|
[#2368](https://github.com/juanfont/headscale/pull/2368)
|
||||||
|
|
||||||
## 0.24.0 (2025-01-17)
|
## 0.24.0 (2025-01-17)
|
||||||
|
|
||||||
|
|
|
@ -245,11 +245,11 @@ func (h *Headscale) scheduledTasks(ctx context.Context) {
|
||||||
|
|
||||||
lastExpiryCheck := time.Unix(0, 0)
|
lastExpiryCheck := time.Unix(0, 0)
|
||||||
|
|
||||||
|
derpTickerChan := make(<-chan time.Time)
|
||||||
|
if h.cfg.DERP.AutoUpdate && h.cfg.DERP.UpdateFrequency != 0 {
|
||||||
derpTicker := time.NewTicker(h.cfg.DERP.UpdateFrequency)
|
derpTicker := time.NewTicker(h.cfg.DERP.UpdateFrequency)
|
||||||
defer derpTicker.Stop()
|
defer derpTicker.Stop()
|
||||||
// If we dont want auto update, just stop the ticker
|
derpTickerChan = derpTicker.C
|
||||||
if !h.cfg.DERP.AutoUpdate {
|
|
||||||
derpTicker.Stop()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var extraRecordsUpdate <-chan []tailcfg.DNSRecord
|
var extraRecordsUpdate <-chan []tailcfg.DNSRecord
|
||||||
|
@ -285,7 +285,7 @@ func (h *Headscale) scheduledTasks(ctx context.Context) {
|
||||||
h.nodeNotifier.NotifyAll(ctx, update)
|
h.nodeNotifier.NotifyAll(ctx, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-derpTicker.C:
|
case <-derpTickerChan:
|
||||||
log.Info().Msg("Fetching DERPMap updates")
|
log.Info().Msg("Fetching DERPMap updates")
|
||||||
h.DERPMap = derp.GetDERPMap(h.cfg.DERP)
|
h.DERPMap = derp.GetDERPMap(h.cfg.DERP)
|
||||||
if h.cfg.DERP.ServerEnabled && h.cfg.DERP.AutomaticallyAddEmbeddedDerpRegion {
|
if h.cfg.DERP.ServerEnabled && h.cfg.DERP.AutomaticallyAddEmbeddedDerpRegion {
|
||||||
|
|
Loading…
Reference in a new issue