1304 Commits

Author SHA1 Message Date
bestgopher 0f6d1b8854 style(examples): use would_block and remove set_nonblocking 2022-06-27 09:48:34 +00:00
Thomas de Zeeuw cda23367f1 Release v0.8.4 2022-06-19 17:09:50 +00:00
Thomas de Zeeuw 93c67c859e Log a warning when polling without subscriptions
On WASM/WASI.
2022-06-19 17:07:44 +00:00
Thomas de Zeeuw 19f8d02904 Add docs about polling without registering event sources
This mainly concerns WASM/WASI.
2022-06-19 17:07:44 +00:00
Richard Zak 8185e426c7 fix: don't try_clone() a debug-only field
Signed-off-by: Richard Zak <richard@profian.com>
2022-06-15 21:25:45 +00:00
Tricster 6f99bc9104 Fix typo in example.
Signed-off-by: Tricster <mediosrity@gmail.com>
2022-06-09 08:01:35 +00:00
Richard Zak 1155f86396 Support Registry::try_clone on wasm32-wasi
Signed-off-by: Richard Zak <richard@profian.com>
2022-06-04 19:15:08 +00:00
Sergey Ukolov 94f9ae32a2 Fix typo in changelog 2022-06-02 20:09:08 +00:00
Thomas de Zeeuw f94f594f53 Release v0.8.3 2022-05-08 15:48:54 +00:00
Alan Somers 89f2ea0195 If we're going to use mem::zeroed, we might as well use it. 2022-05-08 15:33:49 +00:00
Alan Somers 6aa97178a7 Future-proof the kevent ABI
FreeBSD 12 adds some new private fields to struct kevent, and it changes
the type of "data" from intptr_t to i64.  For now libc only binds the
11-compat ABI, but that will change some day.  Adjust mio's structure
definitions for compatibility with either ABI.

This should work on all 32 and 64 bit platforms.
2022-05-08 15:33:49 +00:00
Alex Touchet e1edcb60bf chore: update http links in docs to https (#1571) 2022-05-03 18:06:55 -05:00
Alex Touchet e3680a90b0 Relax windows-sys dependency version 2022-05-03 08:34:43 +02:00
Thomas de Zeeuw fc0076a92b Use SIO_* constants defined in windows-sys 2022-04-28 10:09:09 +02:00
Thomas de Zeeuw ffa0ca57c6 Update to windows-sys 0.36
Removes the need for the Win32_NetworkManagement_IpHelper feature as
AF_INET and AF_INET6 are now included in the Win32_Networking_WinSock
feature.
2022-04-28 10:09:09 +02:00
Alan Somers 645e1a6720 Update CI image to FreeBSD 12.3. 12.2 is EoL. 2022-04-14 17:50:09 +02:00
Thomas de Zeeuw 9c5e049633 Improve docs for WouldBlock connection failures 2022-04-11 16:50:59 +02:00
Thomas de Zeeuw 8ba218a520 Document connect calls can return a WouldBlock error
This is a reflect of the Linux manual, which unfortunately doesn't
specify how to determine when the connect call should be retried.
2022-04-11 16:50:59 +02:00
Thomas de Zeeuw 6e7e2db1dc Don't ignore EAGAIN in UDS connect call
Per the Linux manual:
> EAGAIN For nonblocking UNIX domain sockets, the socket is
>        nonblocking, and the connection cannot be completed
>        immediately.

Previously the code incorrectly assumed that the connection was now in
progress, which is incorrect. If that were the case EINPROGRESS
would/should be returned by the OS
2022-04-11 16:50:59 +02:00
Kezhu Wang 6e08610f4f Fix incorrect rustdoc for TcpStream::connect 2022-04-10 16:49:55 +02:00
Jake Shadle e039bd8973 Note issue for adding SIO_* constants 2022-03-31 10:34:52 +02:00
Jake Shadle 8a74ea3f7b Oops 2022-03-31 10:34:52 +02:00
Jake Shadle c221b1c627 Use Win32_NetworkManagement_IpHelper feature 2022-03-31 10:34:52 +02:00
Jake Shadle 65530c7559 Remove nested imports 2022-03-31 10:34:52 +02:00
Jake Shadle f315ade2f8 Clarify undocumented NT function 2022-03-31 10:34:52 +02:00
Jake Shadle 97355e6c2c Loosen version restriction 2022-03-31 10:34:52 +02:00
Jake Shadle abd42de62e Gate from_entry 2022-03-31 10:34:52 +02:00
Jake Shadle 3f7d604f9f Add Handle wrapper 2022-03-31 10:34:52 +02:00
Jake Shadle 4675a40b22 Fix unused import 2022-03-31 10:34:52 +02:00
Jake Shadle e1526140d0 Remove miow dependency 2022-03-31 10:34:52 +02:00
Jake Shadle 5062de3097 Remove unneeded doc comment 2022-03-31 10:34:52 +02:00
Jake Shadle 527db2e976 Replace winapi/ntapi with windows-sys
This updates miow to 0.4, which now uses the windows-sys crate instead
of winapi, as the former is maintained and updated frequently as opposed
to winapi. The windows-sys crate also covers more of the Windows API
surface, which also allowed me to remove the dependency on ntapi (as it
still depends on winapi). There was only a single function,
`NtCancelIoFileEx` that was present in ntapi but not windows-sys, so I
merely added the extern declaration in the one place it was used as it
is not worth bringing in a dependency just for that.
2022-03-31 10:34:52 +02:00
Jeremy Soller 5d8cc365f3 Update libc to 0.2.121 2022-03-18 21:56:36 +01:00
Jeremy Soller c104261734 Add Redox to cross compile CI 2022-03-18 21:56:36 +01:00
Thomas de Zeeuw bde8950000 Release v0.8.2 2022-03-17 20:07:38 +01:00
Jeremy Soller 3e456e8259 Add Redox support (#1553) 2022-03-17 13:53:41 -05:00
Thomas de Zeeuw bfeed8c6b3 Release v0.8.1 2022-03-11 14:39:19 +01:00
masa.koz 81c323a127 Add try_io method to all I/O types
This execute a user defined I/O closure while updating Mio's internal
state ensuring that the I/O receives more events if it hits a WouldBlock
error.

This is added to the following types:
 * TcpStream
 * UdpSocket
 * UnixDatagram
 * UnixStream
 * unix::pipe::Sender
 * unix::pipe::Receiver
2022-03-11 10:16:10 +01:00
Harald Hoyer ad45d500dd Add tcp_listenfd_server example with target_os = "wasi" support
Use the `LISTEN_FDS` mechanism to use pre-opened sockets.

Especially for `wasm32-wasi` there is no other way to get access to sockets,
than to use pre-opened sockets.

Because `wasm32-wasi` does not yet return `TcpListener::local_addr()`, an
unspecified IP address and port will be returned and displayed.

```
$ cargo +nightly build --target wasm32-wasi --release --example tcp_listenfd_server --features="os-poll net"
   Compiling cfg-if v1.0.0
   Compiling wasi v0.10.2+wasi-snapshot-preview1
   Compiling log v0.4.14
   Compiling libc v0.2.112
   Compiling ppv-lite86 v0.2.15
   Compiling wasi v0.11.0+wasi-snapshot-preview1
   Compiling getrandom v0.2.3
   Compiling rand_core v0.6.3
   Compiling env_logger v0.8.4
   Compiling rand_chacha v0.3.1
   Compiling mio v0.8.0 (/home/harald/git/mio)
   Compiling rand v0.8.4
    Finished release [optimized] target(s) in 2.92s

$ wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/release/examples/tcp_listenfd_server.wasm
Using preopened socket FD 3
You can connect to the server using `nc`:
 $ nc <IP> <PORT>
You'll see our welcome message and anything you type will be printed here.
```

Signed-off-by: Harald Hoyer <harald@profian.com>
2022-03-08 20:27:18 +01:00
Harald Hoyer e2a7548eb7 Stub non-working examples for target_os = "wasi"
Otherwise `cargo test` fails.

Signed-off-by: Harald Hoyer <harald@profian.com>
2022-03-08 20:27:18 +01:00
Harald Hoyer fff06a064b Disable all tests, which don't pass for target_os = "wasi"
Signed-off-by: Harald Hoyer <harald@profian.com>
2022-03-08 20:27:18 +01:00
Harald Hoyer a240295941 Add polling and networking for target_os = "wasi"
Based on https://github.com/tokio-rs/mio/pull/1395

And with
* https://github.com/bytecodealliance/wasmtime/pull/3711
* https://github.com/rust-lang/rust/pull/93158
merged, mio can have limited support for networking for the
`wasm32-wasi` target.

Co-authored-by: Thomas de Zeeuw <thomasdezeeuw@gmail.com>
Signed-off-by: Harald Hoyer <harald@profian.com>
2022-03-08 20:27:18 +01:00
mqy 119e4f20f5 Fixed clippy warning: needlless_borrow.
See https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow.
2022-02-15 19:42:21 +01:00
Thomas de Zeeuw 246b86d806 Change to Windows latest image on Azure CI 2022-02-15 10:27:31 +01:00
Martin Ombura Jr 34f384f277 removes comma from features comment
There's a comma when explaining the features mod that breaks the sentence awkwardly.
2022-02-11 10:16:11 +01:00
Thomas de Zeeuw 82920fe1b5 Move Poll::new method into a single impl block
Make the documentation a bit nicer. Usually the creation methods, such
as new, are the first methods in the first impl block, so that is where
people look for them.
2021-12-26 00:28:00 +01:00
Thomas de Zeeuw 9387e554fd Remove Solaris from readme
Solaris support was already removed in
https://github.com/tokio-rs/mio/pull/1528, but the readme still
mentioned it.
2021-12-12 17:39:49 +01:00
Taiki Endo 1f33741670 Mention remove of os-util feature in changelog 2021-11-23 12:52:31 +01:00
Alex Touchet 33322e113d Update version number in Readme 2021-11-20 20:43:39 +01:00
Thomas de Zeeuw fde5a334bb Release v0.8.0 2021-11-13 13:18:07 +01:00