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 3 commits into
base: master
Choose a base branch
from

Commits on Sep 13, 2024

  1. os: fix missing and incorrect msghdr definitions

    Macos uses the BSD definition of msghdr
    
    All linux architectures share a single msghdr definition. Many
    architectures had manually inserted padding fields that were endian
    specific and some had fields with different integers. This unifies all
    architectures to use a single correct msghdr definition.
    truemedian committed Sep 13, 2024
    Configuration menu
    Copy the full SHA
    761337d View commit details
    Browse the repository at this point in the history
  2. 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.
    
    std.net: adjust send/recv error sets to match documentation
    
    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.
    
    grafted Add ECONNREFUSED to sendto
    truemedian committed Sep 13, 2024
    Configuration menu
    Copy the full SHA
    db16d80 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    91e14f5 View commit details
    Browse the repository at this point in the history