From b1eb87e495fed84e8ed6b808063a2e8c9ff2496a Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 28 Mar 2015 20:15:34 +0100 Subject: [PATCH] =?UTF-8?q?NetPlay:=20Don=E2=80=99t=20wait=20forever=20in?= =?UTF-8?q?=20the=20traversal=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Source/Core/Core/NetPlayClient.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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!"); }