DOT deliver2 -> DONE [style=bold]
*/
-static void
+static int
cnt_deliver(struct worker *w, struct sess *sp)
{
vca_write_obj(w, sp);
sp->step = STP_DONE;
+ return (0);
}
DOT ]
*/
-static void
+static int
cnt_done(struct worker *w, struct sess *sp)
{
char *b;
strcmp(b, "HTTP/1.1")) {
vca_close_session(sp, "not HTTP/1.1");
}
+ return (1);
}
DOT error -> DONE
*/
-static void cnt_error(struct worker *w, struct sess *sp) { (void)w; (void)sp; INCOMPL(); }
+static int cnt_error(struct worker *w, struct sess *sp) { (void)w; (void)sp; INCOMPL(); }
/*--------------------------------------------------------------------
DOT fetch_error -> ERROR
*/
-static void
+static int
cnt_fetch(struct worker *w, struct sess *sp)
{
HSH_Deref(sp->obj);
sp->obj = NULL;
sp->step = STP_PASSBODY;
- return;
+ return (0);
}
if (sp->handling == VCL_RET_INSERT_PASS) {
sp->obj->pass = 1;
HSH_Unbusy(sp->obj);
sp->obj = NULL;
sp->step = STP_PASSBODY;
- return;
+ return (0);
}
if (sp->handling == VCL_RET_INSERT) {
sp->obj->cacheable = 1;
FetchBody(w, sp);
sp->step = STP_DELIVER;
- return;
+ return (0);
}
if (sp->handling == VCL_RET_ERROR)
INCOMPL();
DOT hit2 -> DELIVER [style=bold]
*/
-static void
+static int
cnt_hit(struct worker *w, struct sess *sp)
{
HSH_Deref(sp->obj);
sp->obj = NULL;
sp->step = STP_DONE;
- return;
+ return (0);
}
if (sp->handling == VCL_RET_PASS) {
HSH_Deref(sp->obj);
sp->obj = NULL;
PassSession(w, sp);
sp->step = STP_PASSBODY;
- return;
+ return (0);
}
if (sp->handling == VCL_RET_ERROR)
DOT lookup2 -> MISS [label="miss", style=bold]
*/
-static void
+static int
cnt_lookup(struct worker *w, struct sess *sp)
{
if (sp->obj->busy) {
VSL_stats->cache_miss++;
sp->step = STP_MISS;
- return;
+ return (0);
}
if (sp->obj->pass) {
VSL_stats->cache_hitpass++;
VSL(SLT_HitPass, sp->fd, "%u", sp->obj->xid);
sp->step = STP_HIT;
- return;
+ return (0);
}
VSL_stats->cache_hit++;
VSL(SLT_Hit, sp->fd, "%u", sp->obj->xid);
sp->step = STP_HIT;
+ return (0);
}
DOT
*/
-static void
+static int
cnt_miss(struct worker *w, struct sess *sp)
{
sp->obj = 0;
PassSession(w, sp);
sp->step = STP_PASSBODY;
- return;
+ return (0);
}
if (sp->handling == VCL_RET_LOOKUP)
INCOMPL();
if (sp->handling == VCL_RET_FETCH) {
FetchHeaders(w, sp);
sp->step = STP_FETCH;
- return;
+ return (0);
}
INCOMPL();
}
DOT pass -> PASSBODY
*/
-static void
+static int
cnt_pass(struct worker *w, struct sess *sp)
{
PassSession(w, sp);
sp->step = STP_PASSBODY;
+ return (0);
}
DOT passbody -> DONE
*/
-static void
+static int
cnt_passbody(struct worker *w, struct sess *sp)
{
PassBody(w, sp);
sp->step = STP_DONE;
- return;
+ return (0);
}
DOT pipe -> DONE
*/
-static void
+static int
cnt_pipe(struct worker *w, struct sess *sp)
{
PipeSession(w, sp);
sp->step = STP_DONE;
+ return (0);
}
DOT recv_error -> ERROR
*/
-static void
+static int
cnt_recv(struct worker *w, struct sess *sp)
{
int done;
if (done != 0) {
RES_Error(w, sp, done, NULL);
sp->step = STP_DONE;
- return;
+ return (0);
}
sp->backend = sp->vcl->backend[0];
case VCL_RET_LOOKUP:
/* XXX: discard req body, if any */
sp->step = STP_LOOKUP;
- return;
+ return (0);
case VCL_RET_PIPE:
sp->step = STP_PIPE;
- return;
+ return (0);
case VCL_RET_PASS:
sp->step = STP_PASS;
- return;
+ return (0);
case VCL_RET_ERROR:
/* XXX: discard req body, if any */
sp->step = STP_ERROR;
- return;
+ return (0);
default:
INCOMPL();
}
void
CNT_Session(struct worker *w, struct sess *sp)
{
+ int done;
sp->t0 = time(NULL);
sp->vcl = VCL_Get();
SES_RefSrcAddr(sp);
- for (sp->step = STP_RECV; sp->step != STP_DONE; ) {
+ sp->step = STP_RECV;
+ for (done = 0; !done; ) {
switch (sp->step) {
#define STEP(l,u) \
case STP_##u: \
VSL(SLT_Debug, sp->fd, "State " #u); \
- cnt_##l(w, sp); \
+ done = cnt_##l(w, sp); \
break;
#include "steps.h"
#undef STEP
}
}
- cnt_done(w, sp); /* The loop doesn't do this */
-
VCL_Rel(sp->vcl);
sp->vcl = NULL;