Skip to content

Commit

Permalink
scorer: better handling of KissCode responses
Browse files Browse the repository at this point in the history
- Score RATE responses as -3.5 instead of -5
- Turn off servers with DENY/RSTR responses (set score to -50)

abh/ntppool#228
  • Loading branch information
abh committed Aug 14, 2023
1 parent d9e8f9d commit fb60036
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scorer/statusscore/statusscore.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,16 @@ func (s *StatusScorer) calc(server *ntpdb.Server, status *pb.ServerStatus) (*sco

step := 0.0

if status.Stratum == 0 || status.NoResponse {
if status.NoResponse {
step = -5
} else if status.Stratum == 0 && status.Error == "RATE" {
step = -3.5
} else if status.Stratum == 0 && (status.Error == "RSTR" || status.Error == "DENY") {
step = -10
sc.HasMaxScore = true
sc.MaxScore = -50
} else if len(status.Error) > 0 {
step = -4 // what errors would this be that have a response but aren't RATE?
} else {
offsetAbs := status.AbsoluteOffset()
if *offsetAbs > 3*time.Second || status.Stratum >= 8 {
Expand Down

0 comments on commit fb60036

Please sign in to comment.