diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/internal_network/sockets.h | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/core/internal_network/sockets.h b/src/core/internal_network/sockets.h index 2e328c645..11e479e50 100644 --- a/src/core/internal_network/sockets.h +++ b/src/core/internal_network/sockets.h @@ -5,6 +5,7 @@ #include <map> #include <memory> +#include <span> #include <utility> #if defined(_WIN32) @@ -35,13 +36,10 @@ public: SocketBase() = default; explicit SocketBase(SOCKET fd_) : fd{fd_} {} - virtual ~SocketBase() = default; - virtual SocketBase& operator=(const SocketBase&) = delete; - - // Avoid closing sockets implicitly - virtual SocketBase& operator=(SocketBase&&) noexcept = delete; + YUZU_NON_COPYABLE(SocketBase); + YUZU_NON_MOVEABLE(SocketBase); virtual Errno Initialize(Domain domain, Type type, Protocol protocol) = 0; @@ -66,9 +64,9 @@ public: virtual std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message, SockAddrIn* addr) = 0; - virtual std::pair<s32, Errno> Send(const std::vector<u8>& message, int flags) = 0; + virtual std::pair<s32, Errno> Send(std::span<const u8> message, int flags) = 0; - virtual std::pair<s32, Errno> SendTo(u32 flags, const std::vector<u8>& message, + virtual std::pair<s32, Errno> SendTo(u32 flags, std::span<const u8> message, const SockAddrIn* addr) = 0; virtual Errno SetLinger(bool enable, u32 linger) = 0; @@ -108,14 +106,8 @@ public: ~Socket() override; - Socket(const Socket&) = delete; - Socket& operator=(const Socket&) = delete; - Socket(Socket&& rhs) noexcept; - // Avoid closing sockets implicitly - Socket& operator=(Socket&&) noexcept = delete; - Errno Initialize(Domain domain, Type type, Protocol protocol) override; Errno Close() override; @@ -138,9 +130,9 @@ public: std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message, SockAddrIn* addr) override; - std::pair<s32, Errno> Send(const std::vector<u8>& message, int flags) override; + std::pair<s32, Errno> Send(std::span<const u8> message, int flags) override; - std::pair<s32, Errno> SendTo(u32 flags, const std::vector<u8>& message, + std::pair<s32, Errno> SendTo(u32 flags, std::span<const u8> message, const SockAddrIn* addr) override; Errno SetLinger(bool enable, u32 linger) override; |