Skip to content

Commit

Permalink
fix no unlock upon error
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>
  • Loading branch information
carlosrodfern committed Apr 2, 2024
1 parent 66bd227 commit 8bf8ae1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func (s *smokePingers) prepare(hosts *[]string, interval *time.Duration, privile

maxInterval := *interval
sc.Lock()
defer sc.Unlock()
for _, targetGroup := range sc.C.Targets {
packetSize := targetGroup.Size
if packetSize < 24 || packetSize > 65535 {
Expand All @@ -178,7 +179,6 @@ func (s *smokePingers) prepare(hosts *[]string, interval *time.Duration, privile
pingers = append(pingers, pinger)
}
}
sc.Unlock()
s.prepared = pingers
s.maxInterval = maxInterval
return nil
Expand Down

0 comments on commit 8bf8ae1

Please sign in to comment.