Moved the check for EOF on the Update method

This commit is contained in:
2024-11-03 22:54:40 +00:00
parent 7a1b128d6b
commit 23a7efc37d
+3 -4
View File
@@ -210,6 +210,9 @@ func (i *IBT) Update(timeout time.Duration) (IRacingState, error) {
start := i.Headers.BufOffset + i.Vars.Tick*i.Headers.BufLen
buf := make([]byte, i.Headers.BufLen)
_, err := i.File.ReadAt(buf, int64(start))
if err == io.EOF {
return Ended, nil
}
if err != nil {
return Unknown, err
}
@@ -219,10 +222,6 @@ func (i *IBT) Update(timeout time.Duration) (IRacingState, error) {
log.Fatalf("What happened?\n%v\n", err)
}
if err == io.EOF {
return Ended, nil
}
// This was previously in the read data method, but it probably fits here better
i.Vars.Tick++
}