diff --git a/Source/Core/Common/TraversalClient.cpp b/Source/Core/Common/TraversalClient.cpp index 4c416a0bdb..f3ab481a51 100644 --- a/Source/Core/Common/TraversalClient.cpp +++ b/Source/Core/Common/TraversalClient.cpp @@ -333,6 +333,7 @@ bool EnsureTraversalClient(const std::string& server, u16 server_port, u16 liste g_MainNetHost.reset(); return false; } + host->mtu = std::min(host->mtu, NetPlay::MAX_ENET_MTU); g_MainNetHost.reset(host); g_TraversalClient.reset(new TraversalClient(g_MainNetHost.get(), server, server_port)); } diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 404ae5eef4..db5027fd08 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -144,6 +144,8 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlay return; } + m_client->mtu = std::min(m_client->mtu, NetPlay::MAX_ENET_MTU); + ENetAddress addr; enet_address_set_host(&addr, address.c_str()); addr.port = port; diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h index 5d84e92c78..cfe498ca31 100644 --- a/Source/Core/Core/NetPlayProto.h +++ b/Source/Core/Core/NetPlayProto.h @@ -220,6 +220,7 @@ enum class SyncCodeID : u8 constexpr u32 MAX_NAME_LENGTH = 30; constexpr size_t CHUNKED_DATA_UNIT_SIZE = 16384; +constexpr u32 MAX_ENET_MTU = 1392; // see https://github.com/lsalzman/enet/issues/132 enum : u8 { diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 5d93906e2b..30a2ba894a 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -151,7 +151,10 @@ NetPlayServer::NetPlayServer(const u16 port, const bool forward_port, NetPlayUI* serverAddr.port = port; m_server = enet_host_create(&serverAddr, 10, CHANNEL_COUNT, 0, 0); if (m_server != nullptr) + { + m_server->mtu = std::min(m_server->mtu, NetPlay::MAX_ENET_MTU); m_server->intercept = ENetUtil::InterceptCallback; + } SetupIndex(); }