Commit 3d186d94 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Relieve waiters of the task of receiving the request header, instead

throw the session at a worker thread the moment it becomes readable.
parent a5708d52
...@@ -920,8 +920,7 @@ void SES_Charge(struct sess *sp); ...@@ -920,8 +920,7 @@ void SES_Charge(struct sess *sp);
struct sesspool *SES_NewPool(struct pool *pp, unsigned pool_no); struct sesspool *SES_NewPool(struct pool *pp, unsigned pool_no);
void SES_DeletePool(struct sesspool *sp, struct worker *wrk); void SES_DeletePool(struct sesspool *sp, struct worker *wrk);
int SES_Schedule(struct sess *sp); int SES_Schedule(struct sess *sp);
void SES_Handle(struct sess *sp, int status); void SES_Handle(struct sess *sp);
/* cache_shmlog.c */ /* cache_shmlog.c */
extern struct VSC_C_main *VSC_C_main; extern struct VSC_C_main *VSC_C_main;
......
...@@ -1675,7 +1675,7 @@ CNT_Session(struct sess *sp) ...@@ -1675,7 +1675,7 @@ CNT_Session(struct sess *sp)
*/ */
assert( assert(
sp->step == STP_FIRST || sp->step == STP_FIRST ||
sp->step == STP_START || sp->step == STP_WAIT ||
sp->step == STP_LOOKUP || sp->step == STP_LOOKUP ||
sp->step == STP_RECV); sp->step == STP_RECV);
......
...@@ -279,23 +279,11 @@ SES_Schedule(struct sess *sp) ...@@ -279,23 +279,11 @@ SES_Schedule(struct sess *sp)
*/ */
void void
SES_Handle(struct sess *sp, int status) SES_Handle(struct sess *sp)
{ {
switch (status) { sp->step = STP_WAIT;
case -2: (void)SES_Schedule(sp);
SES_Delete(sp, "blast");
break;
case -1:
SES_Delete(sp, "no request");
break;
case 1:
sp->step = STP_START;
(void)SES_Schedule(sp);
break;
default:
WRONG("Unexpected return from HTC_Rx()");
}
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
......
...@@ -129,13 +129,8 @@ vwe_eev(struct vwe *vwe, const struct epoll_event *ep) ...@@ -129,13 +129,8 @@ vwe_eev(struct vwe *vwe, const struct epoll_event *ep)
} else { } else {
CAST_OBJ_NOTNULL(sp, ep->data.ptr, SESS_MAGIC); CAST_OBJ_NOTNULL(sp, ep->data.ptr, SESS_MAGIC);
if (ep->events & EPOLLIN || ep->events & EPOLLPRI) { if (ep->events & EPOLLIN || ep->events & EPOLLPRI) {
i = HTC_Rx(sp->htc);
if (i == 0) {
vwe_modadd(vwe, sp->fd, sp, EPOLL_CTL_MOD);
return; /* more needed */
}
VTAILQ_REMOVE(&vwe->sesshead, sp, list); VTAILQ_REMOVE(&vwe->sesshead, sp, list);
SES_Handle(sp, i); SES_Handle(sp);
} else if (ep->events & EPOLLERR) { } else if (ep->events & EPOLLERR) {
VTAILQ_REMOVE(&vwe->sesshead, sp, list); VTAILQ_REMOVE(&vwe->sesshead, sp, list);
SES_Delete(sp, "ERR"); SES_Delete(sp, "ERR");
......
...@@ -116,7 +116,6 @@ vwk_pipe_ev(struct vwk *vwk, const struct kevent *kp) ...@@ -116,7 +116,6 @@ vwk_pipe_ev(struct vwk *vwk, const struct kevent *kp)
static void static void
vwk_sess_ev(struct vwk *vwk, const struct kevent *kp) vwk_sess_ev(struct vwk *vwk, const struct kevent *kp)
{ {
int i;
struct sess *sp; struct sess *sp;
AN(kp->udata); AN(kp->udata);
...@@ -129,13 +128,8 @@ vwk_sess_ev(struct vwk *vwk, const struct kevent *kp) ...@@ -129,13 +128,8 @@ vwk_sess_ev(struct vwk *vwk, const struct kevent *kp)
assert((sp->vsl_id & VSL_IDENTMASK) == kp->ident); assert((sp->vsl_id & VSL_IDENTMASK) == kp->ident);
assert((sp->vsl_id & VSL_IDENTMASK) == sp->fd); assert((sp->vsl_id & VSL_IDENTMASK) == sp->fd);
if (kp->data > 0) { if (kp->data > 0) {
i = HTC_Rx(sp->htc);
if (i == 0) {
vwk_kq_sess(vwk, sp, EV_ADD | EV_ONESHOT);
return; /* more needed */
}
VTAILQ_REMOVE(&vwk->sesshead, sp, list); VTAILQ_REMOVE(&vwk->sesshead, sp, list);
SES_Handle(sp, i); SES_Handle(sp);
return; return;
} else if (kp->flags & EV_EOF) { } else if (kp->flags & EV_EOF) {
VTAILQ_REMOVE(&vwk->sesshead, sp, list); VTAILQ_REMOVE(&vwk->sesshead, sp, list);
......
...@@ -153,20 +153,10 @@ vwp_main(void *priv) ...@@ -153,20 +153,10 @@ vwp_main(void *priv)
assert(vwp->pollfd[fd].fd == fd); assert(vwp->pollfd[fd].fd == fd);
if (vwp->pollfd[fd].revents) { if (vwp->pollfd[fd].revents) {
v2--; v2--;
i = HTC_Rx(sp->htc);
if (vwp->pollfd[fd].revents != POLLIN)
VSL(SLT_Debug, fd, "Poll: %x / %d",
vwp->pollfd[fd].revents, i);
vwp->pollfd[fd].revents = 0; vwp->pollfd[fd].revents = 0;
VTAILQ_REMOVE(&vwp->sesshead, sp, list); VTAILQ_REMOVE(&vwp->sesshead, sp, list);
if (i == 0) { vwp_unpoll(vwp, fd);
/* Mov to front of list for speed */ SES_Handle(sp);
VTAILQ_INSERT_HEAD(&vwp->sesshead,
sp, list);
} else {
vwp_unpoll(vwp, fd);
SES_Handle(sp, i);
}
} else if (sp->t_open <= deadline) { } else if (sp->t_open <= deadline) {
VTAILQ_REMOVE(&vwp->sesshead, sp, list); VTAILQ_REMOVE(&vwp->sesshead, sp, list);
vwp_unpoll(vwp, fd); vwp_unpoll(vwp, fd);
......
...@@ -90,13 +90,6 @@ vws_port_ev(struct vws *vws, port_event_t *ev) { ...@@ -90,13 +90,6 @@ vws_port_ev(struct vws *vws, port_event_t *ev) {
SES_Delete(sp, "EOF"); SES_Delete(sp, "EOF");
return; return;
} }
i = HTC_Rx(sp->htc);
if (i == 0) {
/* incomplete header, wait for more data */
vws_add(vws, sp->fd, sp);
return;
}
/* /*
* note: the original man page for port_associate(3C) states: * note: the original man page for port_associate(3C) states:
...@@ -115,7 +108,7 @@ vws_port_ev(struct vws *vws, port_event_t *ev) { ...@@ -115,7 +108,7 @@ vws_port_ev(struct vws *vws, port_event_t *ev) {
VTAILQ_REMOVE(&vws->sesshead, sp, list); VTAILQ_REMOVE(&vws->sesshead, sp, list);
/* SES_Handle will also handle errors */ /* SES_Handle will also handle errors */
SES_Handle(sp, i); SES_Handle(sp);
} }
return; return;
} }
......
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