We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0220709 commit 9f84d0dCopy full SHA for 9f84d0d
serialport.go
@@ -161,14 +161,12 @@ func (p *serport) reader(buftype string) {
161
// Keep track of time difference between two consecutive read with n == 0 and err == nil
162
// we get here if the port has been disconnected while open (cpu usage will jump to 100%)
163
// 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()
+ diff := time.Since(timeCheckOpen)
+ if diff.Nanoseconds() < 1000000 {
+ p.isClosingDueToError = true
+ break
171
}
+ timeCheckOpen = time.Now()
172
173
174
if p.isClosingDueToError {
0 commit comments