summaryrefslogtreecommitdiffstats
path: root/src/core/internal_network
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2023-02-03 06:08:45 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2023-02-03 06:08:45 +0100
commit2d2522693e7d453bf10a8246f704350b69e12ebc (patch)
tree195584b8f97867628b4d5bc37ecfff5c20655cf9 /src/core/internal_network
parentMerge pull request #9713 from unfamiliarplace/master (diff)
downloadyuzu-2d2522693e7d453bf10a8246f704350b69e12ebc.tar
yuzu-2d2522693e7d453bf10a8246f704350b69e12ebc.tar.gz
yuzu-2d2522693e7d453bf10a8246f704350b69e12ebc.tar.bz2
yuzu-2d2522693e7d453bf10a8246f704350b69e12ebc.tar.lz
yuzu-2d2522693e7d453bf10a8246f704350b69e12ebc.tar.xz
yuzu-2d2522693e7d453bf10a8246f704350b69e12ebc.tar.zst
yuzu-2d2522693e7d453bf10a8246f704350b69e12ebc.zip
Diffstat (limited to 'src/core/internal_network')
-rw-r--r--src/core/internal_network/network.cpp4
-rw-r--r--src/core/internal_network/socket_proxy.cpp4
-rw-r--r--src/core/internal_network/socket_proxy.h5
-rw-r--r--src/core/internal_network/sockets.h9
4 files changed, 12 insertions, 10 deletions
diff --git a/src/core/internal_network/network.cpp b/src/core/internal_network/network.cpp
index 282ea1ff9..7494fb62d 100644
--- a/src/core/internal_network/network.cpp
+++ b/src/core/internal_network/network.cpp
@@ -550,7 +550,7 @@ std::pair<s32, Errno> Socket::RecvFrom(int flags, std::vector<u8>& message, Sock
return {-1, GetAndLogLastError()};
}
-std::pair<s32, Errno> Socket::Send(const std::vector<u8>& message, int flags) {
+std::pair<s32, Errno> Socket::Send(std::span<const u8> message, int flags) {
ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
ASSERT(flags == 0);
@@ -563,7 +563,7 @@ std::pair<s32, Errno> Socket::Send(const std::vector<u8>& message, int flags) {
return {-1, GetAndLogLastError()};
}
-std::pair<s32, Errno> Socket::SendTo(u32 flags, const std::vector<u8>& message,
+std::pair<s32, Errno> Socket::SendTo(u32 flags, std::span<const u8> message,
const SockAddrIn* addr) {
ASSERT(flags == 0);
diff --git a/src/core/internal_network/socket_proxy.cpp b/src/core/internal_network/socket_proxy.cpp
index 1e1c42cea..7a77171c2 100644
--- a/src/core/internal_network/socket_proxy.cpp
+++ b/src/core/internal_network/socket_proxy.cpp
@@ -182,7 +182,7 @@ std::pair<s32, Errno> ProxySocket::ReceivePacket(int flags, std::vector<u8>& mes
return {static_cast<u32>(read_bytes), Errno::SUCCESS};
}
-std::pair<s32, Errno> ProxySocket::Send(const std::vector<u8>& message, int flags) {
+std::pair<s32, Errno> ProxySocket::Send(std::span<const u8> message, int flags) {
LOG_WARNING(Network, "(STUBBED) called");
ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
ASSERT(flags == 0);
@@ -200,7 +200,7 @@ void ProxySocket::SendPacket(ProxyPacket& packet) {
}
}
-std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, const std::vector<u8>& message,
+std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, std::span<const u8> message,
const SockAddrIn* addr) {
ASSERT(flags == 0);
diff --git a/src/core/internal_network/socket_proxy.h b/src/core/internal_network/socket_proxy.h
index f12b5f567..9421492bc 100644
--- a/src/core/internal_network/socket_proxy.h
+++ b/src/core/internal_network/socket_proxy.h
@@ -4,6 +4,7 @@
#pragma once
#include <mutex>
+#include <span>
#include <vector>
#include <queue>
@@ -48,11 +49,11 @@ public:
std::pair<s32, Errno> ReceivePacket(int flags, std::vector<u8>& message, SockAddrIn* addr,
std::size_t max_length);
- 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;
void SendPacket(ProxyPacket& packet);
- 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;
diff --git a/src/core/internal_network/sockets.h b/src/core/internal_network/sockets.h
index 2e328c645..4c7489258 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)
@@ -66,9 +67,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;
@@ -138,9 +139,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;