mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
NetPlay: Limit ENet's MTU to 1392 as a workaround for dropped packets over VPN via WireGuard, see https://github.com/lsalzman/enet/issues/132
This commit is contained in:
parent
324777406c
commit
1e1041f299
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user