Commit 7d9ca7de authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Eliminate the "first" step, merge it with "wait"

parent cbe58e70
......@@ -665,6 +665,7 @@ struct sess {
struct sockaddr_storage sockaddr;
struct sockaddr_storage mysockaddr;
struct listen_sock *mylsock;
int init_done;
/* formatted ascii client address */
char addr[ADDR_BUFSIZE];
......
......@@ -80,33 +80,42 @@ DOT acceptor -> first [style=bold,color=green]
static unsigned xids;
/*--------------------------------------------------------------------
* A freshly accepted socket
* WAIT
* Collect the request from the client.
*
DOT subgraph xcluster_first {
DOT first [
DOT subgraph xcluster_wait {
DOT wait [
DOT shape=box
DOT label="cnt_first:\nrender\naddresses"
DOT label="cnt_wait:\nwait for\ncomplete\nrequest"
DOT ]
DOT herding [shape=hexagon]
DOT wait -> start [label="got req",style=bold,color=green]
DOT wait -> "SES_Delete()" [label="errors"]
DOT wait -> herding [label="timeout_linger"]
DOT herding -> wait [label="fd read_ready"]
DOT }
DOT first -> wait [style=bold,color=green]
*/
static int
cnt_first(struct sess *sp, struct worker *wrk)
cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
{
struct req *req;
int i, j, tmo;
struct pollfd pfd[1];
double now, when;
const char *why = NULL;
char laddr[ADDR_BUFSIZE];
char lport[PORT_BUFSIZE];
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
/* Allocate a request already now, so we can VSL to it */
AZ(sp->req);
if (req == NULL) {
req = SES_GetReq(sp);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
}
assert(req->sp == sp);
if (!sp->init_done) {
VTCP_name(&sp->sockaddr, sp->sockaddrlen,
sp->addr, sizeof sp->addr, sp->port, sizeof sp->port);
if (cache_param->log_local_addr) {
......@@ -127,46 +136,11 @@ cnt_first(struct sess *sp, struct worker *wrk)
sp->t_rx = sp->t_open;
sp->t_idle = sp->t_open;
sp->step = STP_WAIT;
return (0);
}
/*--------------------------------------------------------------------
* WAIT
* Collect the request from the client.
*
DOT subgraph xcluster_wait {
DOT wait [
DOT shape=box
DOT label="cnt_wait:\nwait for\ncomplete\nrequest"
DOT ]
DOT herding [shape=hexagon]
DOT wait -> start [label="got req",style=bold,color=green]
DOT wait -> "SES_Delete()" [label="errors"]
DOT wait -> herding [label="timeout_linger"]
DOT herding -> wait [label="fd read_ready"]
DOT }
*/
static int
cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
{
int i, j, tmo;
struct pollfd pfd[1];
double now, when;
const char *why = NULL;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
sp->init_done = 1;
}
assert(!isnan(sp->t_rx));
if (req == NULL) {
req = SES_GetReq(sp);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
}
assert(req->sp == sp);
AZ(req->vcl);
AZ(req->obj);
AZ(req->esi_level);
......@@ -1591,7 +1565,6 @@ CNT_Session(struct sess *sp)
* Possible entrance states
*/
assert(
sp->step == STP_FIRST ||
sp->step == STP_WAIT ||
sp->step == STP_LOOKUP ||
sp->step == STP_RECV);
......@@ -1604,7 +1577,7 @@ CNT_Session(struct sess *sp)
* rather do the syscall in the worker thread.
* On systems which return errors for ioctl, we close early
*/
if ((sp->step == STP_FIRST || sp->step == STP_START) &&
if ((sp->step == STP_WAIT || sp->step == STP_START) &&
VTCP_blocking(sp->fd)) {
if (errno == ECONNRESET)
SES_Close(sp, "remote closed");
......
......@@ -159,7 +159,7 @@ SES_pool_accept_task(struct worker *wrk, void *arg)
VCA_FailSess(wrk);
} else {
VCA_SetupSess(wrk, sp);
sp->step = STP_FIRST;
sp->step = STP_WAIT;
ses_pool_task(wrk, sp);
}
}
......
......@@ -30,7 +30,6 @@
/*lint -save -e525 -e539 */
SESS_STEP(wait, WAIT, (sp, sp->wrk, sp->req))
SESS_STEP(first, FIRST, (sp, sp->wrk))
SESS_STEP(restart, RESTART, (sp, sp->wrk, sp->req))
SESS_STEP(recv, RECV, (sp, sp->wrk, sp->req))
SESS_STEP(start, START, (sp, sp->wrk, sp->req))
......
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