9 Commits
Author SHA1 Message Date
Saleem AbdulrasoolandCory Benfield 7686fbf4b0 NIO: improvements to Windows BSD API (#1659)
Some improvements to the API surface to actually handle some more error
cases correctly and fix typing.

Co-authored-by: Cory Benfield <lukasa@apple.com>
2020-09-30 10:50:10 +01:00
Saleem Abdulrasool b72ed545aa NIO: import additional values from WinSDK (#1640)
These values are referenced but not imported which results in undefined
references.
2020-09-22 10:45:06 +01:00
Saleem AbdulrasoolandCory Benfield 15a2e49402 NIO: fix close(socket:) (#1633)
`Posix.*` cannot be used on Windows.  Sockets and (file) descriptors are
in entirely different namespaces, and will result in an invalid
operation.

Co-authored-by: Cory Benfield <lukasa@apple.com>
2020-09-21 10:45:00 +01:00
f7dc232e0c NIO: remove poll from the _BSDSocketProtocol protocol (#1635)
This removes the testing-only API of `poll` on Windows which does not
have a semantic compatible poll.

Co-authored-by: David Evans <d.evans@apple.com>
Co-authored-by: Cory Benfield <lukasa@apple.com>
2020-09-21 10:31:13 +01:00
Saleem AbdulrasoolandDavid Evans 0c2789c56a NIO: remove unnecessary @discardableResult (#1634)
The function returns `Void`, the attribute does not apply.

Co-authored-by: David Evans <d.evans@apple.com>
2020-09-21 10:01:38 +01:00
Saleem Abdulrasool 36b19f98c3 NIO: repair the build after e3508b0d0 (#1636)
`ssize_t` is not a standard type and does not have a portable Swift
spelling.  Use `size_t` which is compatible in size, but is signed
instead.  This is needed in order to be compatible to more standard
conforming environments like Windows.
2020-09-21 09:36:18 +01:00
Peter Adams ee8acd9b3d Use sendmsg rather than sendto to send UDP data. (#1587)
Motivation:

sendmsg is more powerful - this is paving the way for
Explicit Congestion Notifications to be sent.

Modifications:

Replace the sendto system call with sendmsg up to DatagramChannel.

Result:

Sendmsg will be used to send UDP data.
2020-07-10 13:41:13 +01:00
Cory Benfield e3508b0d04 Move DatagramChannel over to using recvmsg. (#1473)
Motivation:

When attempting to obtain metadata about a read, we need to use recvmsg
in order to obtain that data. While we're using recvmmsg for vector
reads right now, our scalar reads use recvfrom, which does not provide
us with that metadata.

While we're not extracting metadata right now, we may well do so in
future, so we can apply it now.

Modifications:

- Move recvfrom usage to recvmsg.

Result:

We'll be able to extend recvmsg to extract metadata.
2020-07-08 09:10:32 +01:00
Saleem Abdulrasool 5de1e41310 NIO: Implement BSD sockets APIs for Windows (#1471)
Motivation:

Split out the internal implied BSD socket API code to allow alternative implementations of these interfaces on other platforms.

Modifications:

- Split the code apart.
- Provide POSIX and Windows implementations of the BSD socket API.

Result:

Should be easier to run NIO unmodified on Windows.
2020-07-03 10:14:36 +01:00