net/SocketDescriptor: disable msghdr methods on Windows

This commit is contained in:
Max Kellermann
2024-01-18 15:33:57 +01:00
parent 0fbed6dec1
commit b68c3b7f55
2 changed files with 14 additions and 1 deletions

View File

@@ -6,11 +6,12 @@
#include "StaticSocketAddress.hxx"
#include "IPv4Address.hxx"
#include "IPv6Address.hxx"
#include "MsgHdr.hxx"
#ifdef _WIN32
#include <ws2tcpip.h>
#else
#include "MsgHdr.hxx"
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -418,6 +419,8 @@ SocketDescriptor::Receive(std::span<std::byte> dest, int flags) const noexcept
return ::recv(Get(), (char *)dest.data(), dest.size(), flags);
}
#ifndef _WIN32
ssize_t
SocketDescriptor::Receive(struct msghdr &msg, int flags) const noexcept
{
@@ -431,6 +434,8 @@ SocketDescriptor::Receive(std::span<const struct iovec> v, int flags) const noex
return Receive(msg, flags);
}
#endif // !_WIN32
ssize_t
SocketDescriptor::Send(std::span<const std::byte> src, int flags) const noexcept
{
@@ -441,6 +446,8 @@ SocketDescriptor::Send(std::span<const std::byte> src, int flags) const noexcept
return ::send(Get(), (const char *)src.data(), src.size(), flags);
}
#ifndef _WIN32
ssize_t
SocketDescriptor::Send(const struct msghdr &msg, int flags) const noexcept
{
@@ -457,6 +464,8 @@ SocketDescriptor::Send(std::span<const struct iovec> v, int flags) const noexcep
return Send(MakeMsgHdr(v), flags);
}
#endif // !_WIN32
ssize_t
SocketDescriptor::ReadNoWait(std::span<std::byte> dest) const noexcept
{