Add a reload time for the XLX Hosts file.

This commit is contained in:
Jonathan Naylor
2017-09-26 13:08:35 +01:00
parent 82e6b90454
commit a057f757ab
6 changed files with 39 additions and 6 deletions

View File

@@ -26,10 +26,13 @@
#include <cstring>
#include <cctype>
CReflectors::CReflectors(const std::string& hostsFile) :
CReflectors::CReflectors(const std::string& hostsFile, unsigned int reloadTime) :
m_hostsFile(hostsFile),
m_reflectors()
m_reflectors(),
m_timer(1000U, reloadTime * 60U)
{
if (reloadTime > 0U)
m_timer.start();
}
CReflectors::~CReflectors()
@@ -95,3 +98,13 @@ CReflector* CReflectors::find(unsigned int id)
return NULL;
}
void CReflectors::clock(unsigned int ms)
{
m_timer.clock(ms);
if (m_timer.isRunning() && m_timer.hasExpired()) {
load();
m_timer.start();
}
}