File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -161,14 +161,12 @@ func (p *serport) reader(buftype string) {
161
161
// Keep track of time difference between two consecutive read with n == 0 and err == nil
162
162
// we get here if the port has been disconnected while open (cpu usage will jump to 100%)
163
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 ()
164
+ diff := time .Since (timeCheckOpen )
165
+ if diff .Nanoseconds () < 1000000 {
166
+ p .isClosingDueToError = true
167
+ break
171
168
}
169
+ timeCheckOpen = time .Now ()
172
170
}
173
171
}
174
172
if p .isClosingDueToError {
You can’t perform that action at this time.
0 commit comments