mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-26 04:06:32 +00:00
pull in project-slippi/Ishiiruka/commit/14060a2921cc56a4cf9e28d30af43ebebfdd19c3
This commit is contained in:
parent
4f1bf265f8
commit
b8d232ea44
1 changed files with 16 additions and 9 deletions
|
@ -563,11 +563,18 @@ void SlippiNetplayClient::ThreadFunc()
|
||||||
netEvent.peer->address.host, netEvent.peer->address.port);
|
netEvent.peer->address.host, netEvent.peer->address.port);
|
||||||
for (int i = 0; i < m_server.size(); i++)
|
for (int i = 0; i < m_server.size(); i++)
|
||||||
{
|
{
|
||||||
INFO_LOG(SLIPPI_ONLINE, "[Netplay] Comparing connection address: %x:%d - %x:%d",
|
// This check used to check for port as well as host. The problem was that for some
|
||||||
remoteAddrs[i].host, remoteAddrs[i].port, netEvent.peer->address.host,
|
// people, their internet will switch the port they're sending from. This means these
|
||||||
netEvent.peer->address.port);
|
// people struggle to connect to others but they sometimes do succeed. When we were
|
||||||
if (remoteAddrs[i].host == netEvent.peer->address.host &&
|
// checking for port here though we would get into a state where the person they succeeded
|
||||||
remoteAddrs[i].port == netEvent.peer->address.port)
|
// to connect to would not accept the connection with them, this would lead the player
|
||||||
|
// with this internet issue to get stuck waiting for the other player. The only downside
|
||||||
|
// to this that I can guess is that if you fail to connect to one person out of two that
|
||||||
|
// are on your LAN, it might report that you failed to connect to the wrong person. There
|
||||||
|
// might be more problems tho, not sure
|
||||||
|
INFO_LOG(SLIPPI_ONLINE, "[Netplay] Comparing connection address: %x - %x",
|
||||||
|
remoteAddrs[i].host, netEvent.peer->address.host);
|
||||||
|
if (remoteAddrs[i].host == netEvent.peer->address.host && !connections[i])
|
||||||
{
|
{
|
||||||
INFO_LOG(SLIPPI_ONLINE, "[Netplay] Overwriting ENetPeer for address: %x:%d",
|
INFO_LOG(SLIPPI_ONLINE, "[Netplay] Overwriting ENetPeer for address: %x:%d",
|
||||||
netEvent.peer->address.host, netEvent.peer->address.port);
|
netEvent.peer->address.host, netEvent.peer->address.port);
|
||||||
|
@ -692,7 +699,7 @@ void SlippiNetplayClient::ThreadFunc()
|
||||||
if (net > 0)
|
if (net > 0)
|
||||||
{
|
{
|
||||||
sf::Packet rpac;
|
sf::Packet rpac;
|
||||||
bool sameClient = false;
|
bool isConnectedClient = false;
|
||||||
switch (netEvent.type)
|
switch (netEvent.type)
|
||||||
{
|
{
|
||||||
case ENET_EVENT_TYPE_RECEIVE:
|
case ENET_EVENT_TYPE_RECEIVE:
|
||||||
|
@ -707,16 +714,16 @@ void SlippiNetplayClient::ThreadFunc()
|
||||||
if (remoteAddrs[i].host == netEvent.peer->address.host &&
|
if (remoteAddrs[i].host == netEvent.peer->address.host &&
|
||||||
remoteAddrs[i].port == netEvent.peer->address.port)
|
remoteAddrs[i].port == netEvent.peer->address.port)
|
||||||
{
|
{
|
||||||
sameClient = true;
|
isConnectedClient = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Netplay] Disconnected Event detected: %s",
|
ERROR_LOG(SLIPPI_ONLINE, "[Netplay] Disconnected Event detected: %s",
|
||||||
sameClient ? "same client" : "diff client");
|
isConnectedClient ? "connected client" : "superfluous client");
|
||||||
|
|
||||||
// If the disconnect event doesn't come from the client we are actually listening to,
|
// If the disconnect event doesn't come from the client we are actually listening to,
|
||||||
// it can be safely ignored
|
// it can be safely ignored
|
||||||
if (sameClient)
|
if (isConnectedClient)
|
||||||
{
|
{
|
||||||
m_do_loop.Clear(); // Stop the loop, will trigger a disconnect
|
m_do_loop.Clear(); // Stop the loop, will trigger a disconnect
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue