diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/internal_network/network.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/internal_network/network.cpp b/src/core/internal_network/network.cpp index 282ea1ff9..75ac10a9c 100644 --- a/src/core/internal_network/network.cpp +++ b/src/core/internal_network/network.cpp @@ -109,6 +109,8 @@ Errno TranslateNativeError(int e) { return Errno::AGAIN; case WSAECONNREFUSED: return Errno::CONNREFUSED; + case WSAECONNRESET: + return Errno::CONNRESET; case WSAEHOSTUNREACH: return Errno::HOSTUNREACH; case WSAENETDOWN: @@ -205,6 +207,8 @@ Errno TranslateNativeError(int e) { return Errno::AGAIN; case ECONNREFUSED: return Errno::CONNREFUSED; + case ECONNRESET: + return Errno::CONNRESET; case EHOSTUNREACH: return Errno::HOSTUNREACH; case ENETDOWN: @@ -352,7 +356,7 @@ NetworkInstance::~NetworkInstance() { std::optional<IPv4Address> GetHostIPv4Address() { const auto network_interface = Network::GetSelectedNetworkInterface(); if (!network_interface.has_value()) { - LOG_ERROR(Network, "GetSelectedNetworkInterface returned no interface"); + LOG_DEBUG(Network, "GetSelectedNetworkInterface returned no interface"); return {}; } @@ -550,7 +554,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,12 +567,12 @@ 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); const sockaddr* to = nullptr; - const int tolen = addr ? sizeof(sockaddr) : 0; + const int to_len = addr ? sizeof(sockaddr) : 0; sockaddr host_addr_in; if (addr) { @@ -577,7 +581,7 @@ std::pair<s32, Errno> Socket::SendTo(u32 flags, const std::vector<u8>& message, } const auto result = sendto(fd, reinterpret_cast<const char*>(message.data()), - static_cast<int>(message.size()), 0, to, tolen); + static_cast<int>(message.size()), 0, to, to_len); if (result != SOCKET_ERROR) { return {static_cast<s32>(result), Errno::SUCCESS}; } |