summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-03-28 20:15:34 +0100
committermathieui <mathieui@mathieui.net>2015-03-28 20:15:34 +0100
commitb1eb87e495fed84e8ed6b808063a2e8c9ff2496a (patch)
tree76ecdc85f5ba452d8bc2b703f119014e60f4c763 /Source/Core
parentc45ffa937eb79848002a29948eade27065a03ad2 (diff)
NetPlay: Don’t wait forever in the traversal client
With some specific, STUN-hostile routers, the netplay client can get stuck forever while trying to connect to the stun server. This adds a 5 seconds (much more than should be necessary if it works) timer until a failure is registered and the attempt stops.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/NetPlayClient.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp
index b424932e77..1802a67e59 100644
--- a/Source/Core/Core/NetPlayClient.cpp
+++ b/Source/Core/Core/NetPlayClient.cpp
@@ -137,6 +137,9 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlay
OnTraversalStateChanged();
m_connecting = true;
+ Common::Timer connect_timer;
+ connect_timer.Start();
+
while (m_connecting)
{
ENetEvent netEvent;
@@ -160,6 +163,8 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlay
break;
}
}
+ if (connect_timer.GetTimeElapsed() > 5000)
+ break;
}
PanicAlertT("Failed To Connect!");
}