when service pause for a long time, force invalidate cache after system resume
This commit is contained in:
@@ -2222,8 +2222,22 @@ static void _dns_server_tcp_idle_check(void)
|
||||
static void _dns_server_period_run_second(void)
|
||||
{
|
||||
static unsigned int sec = 0;
|
||||
static time_t last = 0;
|
||||
time_t now;
|
||||
sec++;
|
||||
|
||||
time(&now);
|
||||
if (last == 0) {
|
||||
last = now;
|
||||
}
|
||||
|
||||
if (now - 180 > last) {
|
||||
dns_cache_invalidate(NULL, 0);
|
||||
tlog(TLOG_WARN, "Service paused for 180s, force invalidate cache.");
|
||||
}
|
||||
|
||||
last = now;
|
||||
|
||||
if (sec % 2 == 0) {
|
||||
if (dns_conf_prefetch) {
|
||||
/* do pre-fetching */
|
||||
|
||||
Reference in New Issue
Block a user