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

std.net: use send/recv for streams, support vectorized network io on windows #19751

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Commits on May 31, 2024

  1. std.net: use send/recv for streams, support vectorized io on windows

    The primary goal of this change is to use `send` and `recv` for network
    streams, this also enables passing per-message flags like `MSG_NOSIGNAL`
    instead of installing a SIGPIPE handler.
    
    - Alongside using recv and send, windows now uses WSARecvFrom and WSASendTo
      for readv and writev. This enables vectorized network I/O on windows.
    
    Introduces a mostly platform agnostic iovec as `std.net.IoSlice` and
    `std.net.IoSliceConst`. This provides a singular interface to vectorized
    network I/O on windows and posix.
    
    - The only problem this introduces is windows using `u32` for lengths
      and posix using `usize`. So windows is limited to 4GB slices while posix is not.
    
    Removes std.os.windows.ws2_32.WSARecvMsg, as it is not present in ws2_32.dll
    and must be fetched via WSAIoctl.
    
    - The `sendto` and `recvfrom` wrappers around `WSASendTo` and `WSARecvFrom`
      have been removed from `std.os.windows`. These functions are already
      provided by `ws2_32` and are not needed.
    
    This enables the "general client/server API coverage" test on windows.
    The comment on the skip claims that the test was never passing, however
    during my tests the test passed 100% of the time.
    truemedian committed May 31, 2024
    Configuration menu
    Copy the full SHA
    9c83f68 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    00e37e9 View commit details
    Browse the repository at this point in the history
  3. std.posix: clean up send and recv error sets, add recvmsg

    std.net.Stream readv and writev are now implemented with sendmsg and
    recvmsg.
    This primarily removes strictly file-related errors from the error sets
    and removes a layer of indirection in the kernel.
    truemedian committed May 31, 2024
    Configuration menu
    Copy the full SHA
    406ec57 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6346063 View commit details
    Browse the repository at this point in the history