}
sp->t_end = TIM_real();
- sp->wrk->used = sp->t_end;
- assert(!isnan(sp->wrk->used));
+ sp->wrk->lastused = sp->t_end;
if (sp->xid == 0) {
sp->t_req = sp->t_end;
sp->t_resp = sp->t_end;
WSL_Flush(sp->wrk, 0);
/* If we did an ESI include, don't mess up our state */
- if (sp->esis > 0) {
- assert(!isnan(sp->wrk->used));
+ if (sp->esis > 0)
return (1);
- }
sp->t_req = NAN;
if (sp->fd < 0) {
SES_Charge(sp);
VSL_stats->sess_closed++;
- assert(!isnan(sp->wrk->used));
sp->wrk = NULL;
SES_Delete(sp);
return (1);
}
VSL_stats->sess_herd++;
SES_Charge(sp);
- assert(!isnan(sp->wrk->used));
sp->wrk = NULL;
vca_return_session(sp);
return (1);
/* Receive a HTTP protocol request */
HTC_Init(sp->htc, sp->ws, sp->fd);
- sp->wrk->used = sp->t_open;
- assert(!isnan(sp->wrk->used));
+ sp->wrk->lastused = sp->t_open;
sp->wrk->acct.sess++;
SES_RefSrcAddr(sp);
do
if (params->diag_bitmap & 0x20)
WSP(sp, SLT_Debug,
"on waiting list <%s>", sp->objhead->hash);
- /*
- * There is a non-zero risk that we come here more than once
- * before we get through, in that case cnt_recv must be set
- */
- if (isnan(sp->wrk->used))
- sp->wrk->used = TIM_real();
- assert(!isnan(sp->wrk->used));
SES_Charge(sp);
return (1);
}
/* XXX: VSL something */
INCOMPL();
sp->step = STP_DONE;
- assert(!isnan(sp->wrk->used));
return (1);
}
sp->step = STP_PIPE;
/* Update stats of various sorts */
VSL_stats->client_req++; /* XXX not locked */
sp->t_req = TIM_real();
- sp->wrk->used = sp->t_req;
- assert(!isnan(sp->wrk->used));
+ sp->wrk->lastused = sp->t_req;
sp->wrk->acct.req++;
/* Assign XID and log */
w = sp->wrk;
CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
+ /*
+ * Possible entrance states
+ */
+ assert(
+ sp->step == STP_FIRST ||
+ sp->step == STP_START ||
+ sp->step == STP_LOOKUP ||
+ sp->step == STP_RECV);
+
/*
* Whenever we come in from the acceptor we need to set blocking
* mode, but there is no point in setting it when we come from
CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC);
CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
}
- assert(!isnan(w->used));
WSL_Flush(w, 0);
}
CAST_OBJ_NOTNULL(qp, priv, WQ_MAGIC);
memset(w, 0, sizeof *w);
w->magic = WORKER_MAGIC;
- w->used = TIM_real();
+ w->lastused = NAN;
w->wlb = w->wlp = wlog;
w->wle = wlog + sizeof wlog;
AZ(pthread_cond_init(&w->cond, NULL));
qp->nthr++;
while (1) {
CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
- assert(!isnan(w->used));
/* Process overflow requests, if any */
w->wrq = VTAILQ_FIRST(&qp->overflow);
VTAILQ_REMOVE(&qp->overflow, w->wrq, list);
qp->nqueue--;
} else {
+ if (isnan(w->lastused))
+ w->lastused = TIM_real();
VTAILQ_INSERT_HEAD(&qp->idle, w, list);
AZ(pthread_cond_wait(&w->cond, &qp->mtx));
}
AN(w->wrq);
wrq = w->wrq;
AN(wrq->func);
+ w->lastused = NAN;
wrq->func(w, wrq->priv);
w->wrq = NULL;
LOCK(&qp->mtx);
sess->wrk = w;
CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC);
CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
- w->used = NAN;
CNT_Session(sess);
- assert(!isnan(w->used));
CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC);
CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
THR_SetSession(NULL);
LOCK(&qp->mtx);
w = VTAILQ_LAST(&qp->idle, workerhead);
- if (w != NULL && (w->used < t_idle || qp->nthr > nthr_max))
+ if (w != NULL && (w->lastused < t_idle || qp->nthr > nthr_max))
VTAILQ_REMOVE(&qp->idle, w, list);
else
w = NULL;