Commit 606b092f authored by Geoff Simmons's avatar Geoff Simmons

Start the timer after asserting that a new object is uninitialized.

(Not before.)

Fixes #1
parent 440e1dd9
......@@ -408,14 +408,6 @@ vmod_reader__init(VRT_CTX, struct VPFX(file_reader) **rdrp,
timerspec.it_interval.tv_nsec
= (long)(1e9 * (ttl - timerspec.it_interval.tv_sec));
errno = 0;
if (timer_settime(timerid, 0, &timerspec, NULL) != 0) {
VFAIL(ctx, "new %s: cannot start update timer: %s", vcl_name,
vstrerror(errno));
return;
}
rdr->flags |= RDR_TIMER_INIT;
th = init_priv_vcl(priv);
AN(th);
errno = 0;
......@@ -432,6 +424,14 @@ vmod_reader__init(VRT_CTX, struct VPFX(file_reader) **rdrp,
AZ(rdr->info->mtime.tv_sec);
AZ(rdr->info->mtime.tv_nsec);
AZ(rdr->flags & (RDR_INITIALIZED | RDR_ERROR | RDR_DELETED));
errno = 0;
if (timer_settime(timerid, 0, &timerspec, NULL) != 0) {
VFAIL(ctx, "new %s: cannot start update timer: %s", vcl_name,
vstrerror(errno));
return;
}
rdr->flags |= RDR_TIMER_INIT;
do {
VTIM_sleep(INIT_SLEEP_INTERVAL);
} while ((rdr->flags & (RDR_INITIALIZED | RDR_ERROR)) == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment