Skip to content

Commit 9f84d0d

Browse files
committed
Removed always-true condition
1 parent 0220709 commit 9f84d0d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Diff for: serialport.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,12 @@ func (p *serport) reader(buftype string) {
161161
// Keep track of time difference between two consecutive read with n == 0 and err == nil
162162
// we get here if the port has been disconnected while open (cpu usage will jump to 100%)
163163
// let's close the port only if the events are extremely fast (<1ms)
164-
if err == nil {
165-
diff := time.Since(timeCheckOpen)
166-
if diff.Nanoseconds() < 1000000 {
167-
p.isClosingDueToError = true
168-
break
169-
}
170-
timeCheckOpen = time.Now()
164+
diff := time.Since(timeCheckOpen)
165+
if diff.Nanoseconds() < 1000000 {
166+
p.isClosingDueToError = true
167+
break
171168
}
169+
timeCheckOpen = time.Now()
172170
}
173171
}
174172
if p.isClosingDueToError {

0 commit comments

Comments
 (0)