-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Posix Serial Driver Not Unblocking Read on Close #1166
Conversation
Quality Gate passedIssues Measures |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1166 +/- ##
==========================================
+ Coverage 74.98% 74.99% +0.01%
==========================================
Files 595 595
Lines 43914 43922 +8
Branches 757 757
==========================================
+ Hits 32928 32940 +12
+ Misses 10903 10898 -5
- Partials 83 84 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with this technique and how it works.
begin | ||
read_ready, _ = IO.fast_select(@readers, nil, nil, @read_timeout) | ||
rescue IOError | ||
@pipe_reader.close unless @pipe_reader.closed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how closing the pipe_reader is going to help with the serial port handle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closing the pipe reader is just to make sure we don't leave file handles open. Return "" means that we are dead and should no longer be used going forward. IOError should only occur if the serial port has already been closed.
@pipe_reader.close unless @pipe_reader.closed? | ||
return "" | ||
else | ||
retry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This jumps back to the read_nonblock right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
if read_ready | ||
if read_ready.include?(@pipe_reader) | ||
@pipe_reader.close unless @pipe_reader.closed? | ||
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you close the pipe_reader if the read_ready says it's ready?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pipe_reader is only ever ready, if pipe_writer was written. That means we have been closed.
This mostly the same code from sleeper.rb. |
No description provided.