If upnp is disabled, poll the check less aggressively. TODO: should wait for a cond instead.

This commit is contained in:
Henrik Rydgård committed 2024-10-31 23:15:08 +01:00
1 parent 2adbc231f0
commit f690cb99a4
1 file changed
+3 -3
+3 -3
View File
@@ -477,6 +477,9 @@ int upnpService(const unsigned int timeout)
// Service Loop
while (upnpServiceRunning && coreState != CORE_POWERDOWN) {
// Sleep for 1ms for faster response if active, otherwise sleep longer (TODO: Improve on this).
sleep_ms(g_Config.bEnableUPnP ? 1 : 100);
// Attempts to reconnect if not connected yet or got disconnected
if (g_Config.bEnableUPnP && g_PortManager.GetInitState() == UPNP_INITSTATE_NONE) {
g_PortManager.Initialize(timeout);
@@ -506,9 +509,6 @@ int upnpService(const unsigned int timeout)
upnpLock.unlock();
}
}
// Sleep for 1ms for faster response
sleep_ms(1);
}
// Cleaning up regardless of g_Config.bEnableUPnP to prevent lingering open ports on the router