smartdns: support multiline config option and fix timer issue.

This commit is contained in:
Nick Peng
2023-02-02 20:23:53 +08:00
parent 108f514b83
commit 03ba24480b
6 changed files with 28 additions and 12 deletions

View File

@@ -3862,10 +3862,12 @@ static void *_dns_client_work(void *arg)
sleep_time = 0;
}
}
last = now;
if (now >= expect_time) {
_dns_client_period_run();
if (last != now) {
_dns_client_period_run();
}
sleep_time = sleep - (now - expect_time);
if (sleep_time < 0) {
sleep_time = 0;
@@ -3873,6 +3875,7 @@ static void *_dns_client_work(void *arg)
}
expect_time += sleep;
}
last = now;
pthread_mutex_lock(&client.domain_map_lock);
if (list_empty(&client.dns_request_list) && atomic_read(&client.run_period) == 0) {