diff options
author | bunnei <bunneidev@gmail.com> | 2022-10-01 23:53:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-01 23:53:36 +0200 |
commit | 2a752bbd646aefaedd5b2aa334710a48bb6fe907 (patch) | |
tree | 4513e36fa60db1ec1cdcef500088194030e61c83 /src/core/internal_network | |
parent | Merge pull request #9009 from yuzu-emu/bunnei-move-deploy-linux.sh (diff) | |
parent | Address some review comments (diff) | |
download | yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.gz yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.bz2 yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.lz yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.xz yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.zst yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.zip |
Diffstat (limited to 'src/core/internal_network')
-rw-r--r-- | src/core/internal_network/network_interface.cpp | 12 | ||||
-rw-r--r-- | src/core/internal_network/network_interface.h | 1 | ||||
-rw-r--r-- | src/core/internal_network/socket_proxy.cpp | 8 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/core/internal_network/network_interface.cpp b/src/core/internal_network/network_interface.cpp index 0f0a66160..057fd3661 100644 --- a/src/core/internal_network/network_interface.cpp +++ b/src/core/internal_network/network_interface.cpp @@ -188,7 +188,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { std::optional<NetworkInterface> GetSelectedNetworkInterface() { const auto& selected_network_interface = Settings::values.network_interface.GetValue(); const auto network_interfaces = Network::GetAvailableNetworkInterfaces(); - if (network_interfaces.size() == 0) { + if (network_interfaces.empty()) { LOG_ERROR(Network, "GetAvailableNetworkInterfaces returned no interfaces"); return std::nullopt; } @@ -206,4 +206,14 @@ std::optional<NetworkInterface> GetSelectedNetworkInterface() { return *res; } +void SelectFirstNetworkInterface() { + const auto network_interfaces = Network::GetAvailableNetworkInterfaces(); + + if (network_interfaces.empty()) { + return; + } + + Settings::values.network_interface.SetValue(network_interfaces[0].name); +} + } // namespace Network diff --git a/src/core/internal_network/network_interface.h b/src/core/internal_network/network_interface.h index 9b98b6b42..175e61b1f 100644 --- a/src/core/internal_network/network_interface.h +++ b/src/core/internal_network/network_interface.h @@ -24,5 +24,6 @@ struct NetworkInterface { std::vector<NetworkInterface> GetAvailableNetworkInterfaces(); std::optional<NetworkInterface> GetSelectedNetworkInterface(); +void SelectFirstNetworkInterface(); } // namespace Network diff --git a/src/core/internal_network/socket_proxy.cpp b/src/core/internal_network/socket_proxy.cpp index 0c746bd82..7d5d37bbc 100644 --- a/src/core/internal_network/socket_proxy.cpp +++ b/src/core/internal_network/socket_proxy.cpp @@ -6,6 +6,7 @@ #include "common/assert.h" #include "common/logging/log.h" +#include "common/zstd_compression.h" #include "core/internal_network/network.h" #include "core/internal_network/network_interface.h" #include "core/internal_network/socket_proxy.h" @@ -32,8 +33,11 @@ void ProxySocket::HandleProxyPacket(const ProxyPacket& packet) { return; } + auto decompressed = packet; + decompressed.data = Common::Compression::DecompressDataZSTD(packet.data); + std::lock_guard guard(packets_mutex); - received_packets.push(packet); + received_packets.push(decompressed); } template <typename T> @@ -185,6 +189,8 @@ std::pair<s32, Errno> ProxySocket::Send(const std::vector<u8>& message, int flag void ProxySocket::SendPacket(ProxyPacket& packet) { if (auto room_member = room_network.GetRoomMember().lock()) { if (room_member->IsConnected()) { + packet.data = Common::Compression::CompressDataZSTDDefault(packet.data.data(), + packet.data.size()); room_member->SendProxyPacket(packet); } } |