diff options
author | comex <comexk@gmail.com> | 2023-06-20 03:17:43 +0200 |
---|---|---|
committer | comex <comexk@gmail.com> | 2023-06-25 21:53:31 +0200 |
commit | 8e703e08dfcf735a08df2ceff6a05221b7cc981f (patch) | |
tree | 771ebe71883ff9e179156f2b38b21b05070d7667 /src/core/internal_network/socket_proxy.cpp | |
parent | Merge pull request #10825 from 8bitDream/vcpkg-zlib (diff) | |
download | yuzu-8e703e08dfcf735a08df2ceff6a05221b7cc981f.tar yuzu-8e703e08dfcf735a08df2ceff6a05221b7cc981f.tar.gz yuzu-8e703e08dfcf735a08df2ceff6a05221b7cc981f.tar.bz2 yuzu-8e703e08dfcf735a08df2ceff6a05221b7cc981f.tar.lz yuzu-8e703e08dfcf735a08df2ceff6a05221b7cc981f.tar.xz yuzu-8e703e08dfcf735a08df2ceff6a05221b7cc981f.tar.zst yuzu-8e703e08dfcf735a08df2ceff6a05221b7cc981f.zip |
Diffstat (limited to 'src/core/internal_network/socket_proxy.cpp')
-rw-r--r-- | src/core/internal_network/socket_proxy.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/internal_network/socket_proxy.cpp b/src/core/internal_network/socket_proxy.cpp index 7a77171c2..44e9e3093 100644 --- a/src/core/internal_network/socket_proxy.cpp +++ b/src/core/internal_network/socket_proxy.cpp @@ -98,7 +98,7 @@ Errno ProxySocket::Shutdown(ShutdownHow how) { return Errno::SUCCESS; } -std::pair<s32, Errno> ProxySocket::Recv(int flags, std::vector<u8>& message) { +std::pair<s32, Errno> ProxySocket::Recv(int flags, std::span<u8> message) { LOG_WARNING(Network, "(STUBBED) called"); ASSERT(flags == 0); ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); @@ -106,7 +106,7 @@ std::pair<s32, Errno> ProxySocket::Recv(int flags, std::vector<u8>& message) { return {static_cast<s32>(0), Errno::SUCCESS}; } -std::pair<s32, Errno> ProxySocket::RecvFrom(int flags, std::vector<u8>& message, SockAddrIn* addr) { +std::pair<s32, Errno> ProxySocket::RecvFrom(int flags, std::span<u8> message, SockAddrIn* addr) { ASSERT(flags == 0); ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); @@ -140,8 +140,8 @@ std::pair<s32, Errno> ProxySocket::RecvFrom(int flags, std::vector<u8>& message, } } -std::pair<s32, Errno> ProxySocket::ReceivePacket(int flags, std::vector<u8>& message, - SockAddrIn* addr, std::size_t max_length) { +std::pair<s32, Errno> ProxySocket::ReceivePacket(int flags, std::span<u8> message, SockAddrIn* addr, + std::size_t max_length) { ProxyPacket& packet = received_packets.front(); if (addr) { addr->family = Domain::INET; @@ -153,10 +153,7 @@ std::pair<s32, Errno> ProxySocket::ReceivePacket(int flags, std::vector<u8>& mes std::size_t read_bytes; if (packet.data.size() > max_length) { read_bytes = max_length; - message.clear(); - std::copy(packet.data.begin(), packet.data.begin() + read_bytes, - std::back_inserter(message)); - message.resize(max_length); + memcpy(message.data(), packet.data.data(), max_length); if (protocol == Protocol::UDP) { if (!peek) { @@ -171,9 +168,7 @@ std::pair<s32, Errno> ProxySocket::ReceivePacket(int flags, std::vector<u8>& mes } } else { read_bytes = packet.data.size(); - message.clear(); - std::copy(packet.data.begin(), packet.data.end(), std::back_inserter(message)); - message.resize(max_length); + memcpy(message.data(), packet.data.data(), read_bytes); if (!peek) { received_packets.pop(); } @@ -293,6 +288,11 @@ Errno ProxySocket::SetNonBlock(bool enable) { return Errno::SUCCESS; } +std::pair<Errno, Errno> ProxySocket::GetPendingError() { + LOG_DEBUG(Network, "(STUBBED) called"); + return {Errno::SUCCESS, Errno::SUCCESS}; +} + bool ProxySocket::IsOpened() const { return fd != INVALID_SOCKET; } |