Skip to content

Commit

Permalink
simplify random number generation
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Sep 27, 2021
1 parent 73a22d5 commit bed14e1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,9 @@ func (s *Server) probe() {
}
q.Ns = []dns.RR{srv, txt}

randomizer := rand.New(rand.NewSource(time.Now().UnixNano()))

// Wait for a random duration uniformly distributed between 0 and 250 ms
// before sending the first probe packet.
time.Sleep(time.Duration(randomizer.Intn(250)) * time.Millisecond)
time.Sleep(time.Duration(rand.Intn(250)) * time.Millisecond)
for i := 0; i < 3; i++ {
if err := s.multicastResponse(q, 0); err != nil {
log.Println("[ERR] zeroconf: failed to send probe:", err.Error())
Expand Down

0 comments on commit bed14e1

Please sign in to comment.