-
Notifications
You must be signed in to change notification settings - Fork 353
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
[WIP] blocking unnamed_socket #4072
base: master
Are you sure you want to change the base?
Conversation
Planning to open a minor clean-up PR to remove some unused variable here before getting back to this. @rustbot label S-blocked |
☔ The latest upstream changes (presumably #4074) made this pull request unmergeable. Please resolve the merge conflicts. |
@@ -171,82 +167,143 @@ impl FileDescription for AnonSocket { | |||
} | |||
|
|||
/// Write to AnonSocket based on the space available and return the written byte size. | |||
/// This is only for socketpair/pipe without O_NONBLOCK flag. |
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.
Just something on top of my mind while working on this, if we were to support O_NONBLOCK
flag in fcntl
, which has the ability of setting a file descriptor with blocking ability to non-blocking, we need to be careful of it's interaction with all the blocking operation here.
src/shims/unix/unnamed_socket.rs
Outdated
let weak_self_ref = self_ref.downgrade(); | ||
|
||
// We handle return earlier if we hit these two case, and only do the actual read and | ||
// blocking in anonsocket_read. |
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 understand this comment. What do you mean by "handle 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.
Ah it should be "We return early..."
But please ignore the comment for now, I plan to remove that because one of the cases should be moved to the helper function.
} | ||
// TODO: We might need to decide what to do if peer_fd is closed when read is blocked. |
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.
It turns out that we can just follow what we did previously:
for read
, just keep reading if there are data inside readbuf
.
for write
, return ecx.set_last_error_and_return(ErrorKind::BrokenPipe, &dest);
.
This is a very WIP PR opened to ask for some feedback.
TODO:
@rustbot author