From cd3f2f39d0c2dc94f6017fdd808d1e3057f1f60d Mon Sep 17 00:00:00 2001 From: upstream svn Date: Tue, 26 Jan 2021 16:58:11 +0000 Subject: [PATCH] Wait UPnP service responses for 3s before add port mappings --- .svn-revision | 2 +- src/amule.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.svn-revision b/.svn-revision index aed0bd24..8eb7cb60 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -11079 +11080 diff --git a/src/amule.cpp b/src/amule.cpp index fcb984e8..6259f7d1 100644 --- a/src/amule.cpp +++ b/src/amule.cpp @@ -45,6 +45,7 @@ #include #include #include +#include // Needed for wxStopWatch #include // Needed for CFormat @@ -816,6 +817,10 @@ bool CamuleApp::ReinitializeNetwork(wxString* msg) thePrefs::GetUPnPEnabled(), "aMule UDP Extended eMule Socket"); m_upnp = new CUPnPControlPoint(thePrefs::GetUPnPTCPPort()); + + wxStopWatch count; // Wait UPnP service responses for 3s before add port mappings + while (count.Time() < 3000 && !m_upnp->WanServiceDetected()); + m_upnp->AddPortMappings(m_upnpMappings); } catch(CUPnPException &e) { wxString error_msg; -- 2.11.4.GIT