From b68c3b7f551d0c0bbe238ffb2862763dc184aa89 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 18 Jan 2024 15:33:57 +0100 Subject: [PATCH] net/SocketDescriptor: disable msghdr methods on Windows --- src/net/SocketDescriptor.cxx | 11 ++++++++++- src/net/SocketDescriptor.hxx | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/net/SocketDescriptor.cxx b/src/net/SocketDescriptor.cxx index f255bd885..573c9c849 100644 --- a/src/net/SocketDescriptor.cxx +++ b/src/net/SocketDescriptor.cxx @@ -6,11 +6,12 @@ #include "StaticSocketAddress.hxx" #include "IPv4Address.hxx" #include "IPv6Address.hxx" -#include "MsgHdr.hxx" #ifdef _WIN32 #include #else +#include "MsgHdr.hxx" + #include #include #include @@ -418,6 +419,8 @@ SocketDescriptor::Receive(std::span 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 v, int flags) const noex return Receive(msg, flags); } +#endif // !_WIN32 + ssize_t SocketDescriptor::Send(std::span src, int flags) const noexcept { @@ -441,6 +446,8 @@ SocketDescriptor::Send(std::span 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 v, int flags) const noexcep return Send(MakeMsgHdr(v), flags); } +#endif // !_WIN32 + ssize_t SocketDescriptor::ReadNoWait(std::span dest) const noexcept { diff --git a/src/net/SocketDescriptor.hxx b/src/net/SocketDescriptor.hxx index 94c59c34d..49ec6c74d 100644 --- a/src/net/SocketDescriptor.hxx +++ b/src/net/SocketDescriptor.hxx @@ -303,6 +303,7 @@ public: [[nodiscard]] ssize_t Receive(std::span dest, int flags=0) const noexcept; +#ifndef _WIN32 /** * Wrapper for recvmsg(). */ @@ -314,6 +315,7 @@ public: */ [[nodiscard]] ssize_t Receive(std::span v, int flags=0) const noexcept; +#endif // !_WIN32 /** * Wrapper for send(). @@ -323,6 +325,7 @@ public: [[nodiscard]] ssize_t Send(std::span src, int flags=0) const noexcept; +#ifndef _WIN32 /** * Wrapper for sendmsg(). * @@ -338,6 +341,7 @@ public: */ [[nodiscard]] ssize_t Send(std::span v, int flags=0) const noexcept; +#endif // !_WIN32 [[nodiscard]] ssize_t Read(std::span dest) const noexcept {