mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-21 05:25:40 +08:00
Add a reload time for the XLX Hosts file.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user