mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
do not get the current time for an inactive timer
This commit is contained in:
@@ -246,14 +246,24 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
|
||||
/*
|
||||
* Get current time.
|
||||
*/
|
||||
result = isc_time_now(&now);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_time_now() failed: %s",
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
if (type != isc_timertype_inactive) {
|
||||
result = isc_time_now(&now);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_time_now() failed: %s",
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We don't have to do this, but it keeps the compiler from
|
||||
* complaining about "now" possibly being used without being
|
||||
* set, even though it will never actually happen.
|
||||
*/
|
||||
isc_time_settoepoch(&now);
|
||||
}
|
||||
|
||||
|
||||
mctx = isc_task_mem(task);
|
||||
timer = isc_mem_get(mctx, sizeof *timer);
|
||||
if (timer == NULL)
|
||||
@@ -340,12 +350,21 @@ isc_timer_reset(isc_timer_t *timer, isc_timertype_t type,
|
||||
/*
|
||||
* Get current time.
|
||||
*/
|
||||
result = isc_time_now(&now);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_time_now() failed: %s",
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
if (type != isc_timertype_inactive) {
|
||||
result = isc_time_now(&now);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_time_now() failed: %s",
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We don't have to do this, but it keeps the compiler from
|
||||
* complaining about "now" possibly being used without being
|
||||
* set, even though it will never actually happen.
|
||||
*/
|
||||
isc_time_settoepoch(&now);
|
||||
}
|
||||
|
||||
manager = timer->manager;
|
||||
|
Reference in New Issue
Block a user