Allow changing socket blocking state#4955
Conversation
|
Thank you for contributing to Miri! A reviewer will take a look at your PR, typically within a week or two. |
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
|
This looks great, thanks! After resolving the last comment nit, please squash the commits. You can squash manually if there are multiple independent commits you want to preserve, or use @rustbot author |
9218194 to
34c64c5
Compare
|
@rustbot ready |
|
@RalfJung some test failed on the CI on the PR on my branch, can you still remove it from the merge queue? |
|
I think this is a timing issue. Probably, the socket is still connecting when we're calling |
I've now added a new test, which only tests non-blocking connect and awaits the connection using such a loop. Everywhere else I changed the tests to connect whilst the client socket is blocking and only afterwards set the socket to be non-blocking. |
|
👍 please re-squash. (You can do this preemptively for such tiny fixes if you want.) |
Add shims for `fcntl` and `ioctl` to change socket blocking mode.
96959f2 to
8efb5f2
Compare
Hi,
This pull request adds the required functionality to change the network socket blocking state through
ioctl(used by the standard library) andfcntl.Since the
ioctlshim now allows changing the socket blocking state through the standard library, there are now also some tests for testing non-blocking sockets using the standard library. However, we cannot test non-blocking connects this way, as we would need mio for that.Is it worth adding mio as a test dependency for this in a future PR? Because we already test non-blocking connects using libc.
Also, because setting the blocking state of a socket through
fcntlis supported on all targets, we can now also run the libc non-blocking socket tests on MacOS targets.