diff options
-rw-r--r-- | xbmc/pvr/addons/PVRClients.cpp | 11 | ||||
-rw-r--r-- | xbmc/pvr/addons/PVRClients.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp index c49e9be987..ae11936738 100644 --- a/xbmc/pvr/addons/PVRClients.cpp +++ b/xbmc/pvr/addons/PVRClients.cpp @@ -918,6 +918,17 @@ bool CPVRClients::UpdateAndInitialiseClients(bool bInitialiseAllClients /* = fal } } + // throttle connection attempts, no more than 1 attempt per 5 seconds + if (!bDisabled && addon->Enabled()) + { + time_t now; + CDateTime::GetCurrentDateTime().GetAsTime(now); + std::map<int, time_t>::iterator it = m_connectionAttempts.find(iClientId); + if (it != m_connectionAttempts.end() && now < it->second) + continue; + m_connectionAttempts[iClientId] = now + 5; + } + // re-check the enabled status. newly installed clients get disabled when they're added to the db if (!bDisabled && addon->Enabled() && (status = addon->Create(iClientId)) != ADDON_STATUS_OK) { diff --git a/xbmc/pvr/addons/PVRClients.h b/xbmc/pvr/addons/PVRClients.h index 1265be4ccd..7725fa1e0d 100644 --- a/xbmc/pvr/addons/PVRClients.h +++ b/xbmc/pvr/addons/PVRClients.h @@ -631,5 +631,6 @@ namespace PVR bool m_bNoAddonWarningDisplayed; /*!< true when a warning was displayed that no add-ons were found, false otherwise */ CCriticalSection m_critSection; CAddonDatabase m_addonDb; + std::map<int, time_t> m_connectionAttempts; /*!< last connection attempt per add-on */ }; } |