derp,ipn/ipnlocal: stop calling rand.Seed

It's deprecated and using it gets us the old slow behavior
according to https://go.dev/blog/randv2.

> Having eliminated repeatability of the global output stream, Go 1.20
> was also able to make the global generator scale better in programs
> that don’t call rand.Seed, replacing the Go 1 generator with a very
> cheap per-thread wyrand generator already used inside the Go
> runtime. This removed the global mutex and made the top-level
> functions scale much better. Programs that do call rand.Seed fall
> back to the mutex-protected Go 1 generator.

Updates #7123

Change-Id: Ia5452e66bd16b5457d4b1c290a59294545e13291
Signed-off-by: Maisem Ali <maisem@tailscale.com>
pull/11965/head
Maisem Ali 6 months ago committed by Brad Fitzpatrick
parent be663c84c1
commit 1c10ec8be6

@ -69,10 +69,6 @@ func init() {
} }
} }
func init() {
rand.Seed(time.Now().UnixNano())
}
const ( const (
perClientSendQueueDepth = 32 // packets buffered for sending perClientSendQueueDepth = 32 // packets buffered for sending
writeTimeout = 2 * time.Second writeTimeout = 2 * time.Second

@ -12,7 +12,6 @@ import (
"runtime" "runtime"
"slices" "slices"
"strings" "strings"
"time"
"tailscale.com/clientupdate" "tailscale.com/clientupdate"
"tailscale.com/envknob" "tailscale.com/envknob"
@ -198,10 +197,6 @@ func (pm *profileManager) Reset() {
pm.NewProfile() pm.NewProfile()
} }
func init() {
rand.Seed(time.Now().UnixNano())
}
// SetPrefs sets the current profile's prefs to the provided value. // SetPrefs sets the current profile's prefs to the provided value.
// It also saves the prefs to the StateStore. It stores a copy of the // It also saves the prefs to the StateStore. It stores a copy of the
// provided prefs, which may be accessed via CurrentPrefs. // provided prefs, which may be accessed via CurrentPrefs.

Loading…
Cancel
Save