Skip to content
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

Update raising of WaitReadable/WaitWritable exceptions #3541

Merged
merged 4 commits into from Dec 25, 2015

Conversation

@YorickPeterse
Copy link
Member

@YorickPeterse YorickPeterse commented Dec 25, 2015

This changes IO#read_nonblock and IO#write_nonblock to raise the correct exceptions (using somewhat more flexible code) as well as defining extra WaitReadable / WaitWritable exception classes to be used by rubysl-socket.

IO#read_nonblock is supposed to raise IO::EAGAINWaitReadable instead of
a regular Errno::EAGAIN error.
This tests for IO#write_nonblock raising IO::EAGAINWaitWritable when an
operation would block (instead of just raising Errno::EAGAIN).
IO#read_nonblock should raise IO::EAGAINWaitReadable (or
IO::EWOULDBLOCKWaitReadable) while
IO#write_nonblock should raise IO::EAGAINWaitWritable (or
IO::EWOULDBLOCKWaitWritable).
These will be used by rubysl-socket for connecting a socket in a
non-blocking manner.
@@ -727,7 +727,7 @@ namespace rubinius {
int res = ::select(fd+1, &set, 0, 0, &tv);

if(res == 0) {
Exception::errno_eagain_error(state, "no data ready");
Exception::errno_wait_readable(state, EAGAIN);
Copy link
Member Author

@YorickPeterse YorickPeterse Dec 25, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a hack because errno is not set when select returns 0. Without explicitly passing EAGAIN we'd have to handle this case in Exception::errno_wait_readable which I think is the wrong place to do so (since this behaviour is very specific to select).

brixen added a commit that referenced this issue Dec 25, 2015
Update raising of WaitReadable/WaitWritable exceptions
@brixen brixen merged commit efc8770 into master Dec 25, 2015
1 check passed
@YorickPeterse YorickPeterse deleted the wait-readable-writable branch Dec 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants