2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 23:55:27 +00:00

do not get the current time for an inactive timer

This commit is contained in:
Bob Halley
1999-07-03 21:00:55 +00:00
parent c6ed713695
commit 94a5826150

View File

@@ -246,14 +246,24 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
/* /*
* Get current time. * Get current time.
*/ */
result = isc_time_now(&now); if (type != isc_timertype_inactive) {
if (result != ISC_R_SUCCESS) { result = isc_time_now(&now);
UNEXPECTED_ERROR(__FILE__, __LINE__, if (result != ISC_R_SUCCESS) {
"isc_time_now() failed: %s", UNEXPECTED_ERROR(__FILE__, __LINE__,
isc_result_totext(result)); "isc_time_now() failed: %s",
return (ISC_R_UNEXPECTED); 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); mctx = isc_task_mem(task);
timer = isc_mem_get(mctx, sizeof *timer); timer = isc_mem_get(mctx, sizeof *timer);
if (timer == NULL) if (timer == NULL)
@@ -340,12 +350,21 @@ isc_timer_reset(isc_timer_t *timer, isc_timertype_t type,
/* /*
* Get current time. * Get current time.
*/ */
result = isc_time_now(&now); if (type != isc_timertype_inactive) {
if (result != ISC_R_SUCCESS) { result = isc_time_now(&now);
UNEXPECTED_ERROR(__FILE__, __LINE__, if (result != ISC_R_SUCCESS) {
"isc_time_now() failed: %s", UNEXPECTED_ERROR(__FILE__, __LINE__,
isc_result_totext(result)); "isc_time_now() failed: %s",
return (ISC_R_UNEXPECTED); 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; manager = timer->manager;