Skip to content

Commit

Permalink
Update bin.go
Browse files Browse the repository at this point in the history
Included functionality for checking and resetting updates to check if LZR is in an infinite loop.
  • Loading branch information
ianshih22856 authored Jan 17, 2025
1 parent e9b0339 commit 93f033d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/bin.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ func LZRMain() {
var intervalLoop = options.Timeout*lzr.NumHandshakes()*2
go func() {
for {
time.Sleep(time.Duration(intervalLoop)*time.Second)
startTime := time.Now()
for time.Since(startTime) < time.Duration(intervalLoop)*time.Second {
if (ipMeta.HasUpdates()) {
startTime = time.Now()
ipMeta.ResetUpdates()
continue
}
time.Sleep(time.Duration(intervalLoop)*time.Millisecond)
}
if (ipMetaSize == ipMeta.Count()) {
fmt.Fprintln(os.Stderr,"Infinite Loop, Breaking.")
infiniteLoop = true
Expand Down

0 comments on commit 93f033d

Please sign in to comment.