Commit d533839d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Collapse SES_RxReInit() into SES_RxInit().

parent bdc63fc3
...@@ -962,7 +962,6 @@ enum htc_status_e { ...@@ -962,7 +962,6 @@ enum htc_status_e {
}; };
void SES_RxInit(struct http_conn *htc, struct ws *ws); void SES_RxInit(struct http_conn *htc, struct ws *ws);
void SES_RxReInit(struct http_conn *htc);
enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *, enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *,
double *t1, double *t2, double ti, double tn, int maxbytes); double *t1, double *t2, double ti, double tn, int maxbytes);
......
...@@ -376,7 +376,6 @@ vca_make_session(struct worker *wrk, void *arg) ...@@ -376,7 +376,6 @@ vca_make_session(struct worker *wrk, void *arg)
req = Req_New(wrk, sp); req = Req_New(wrk, sp);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
req->htc->fd = sp->fd; req->htc->fd = sp->fd;
SES_RxInit(req->htc, req->ws);
SES_SetTransport(wrk, sp, req, wa->acceptlsock->transport); SES_SetTransport(wrk, sp, req, wa->acceptlsock->transport);
} }
......
...@@ -66,6 +66,8 @@ Req_New(const struct worker *wrk, struct sess *sp) ...@@ -66,6 +66,8 @@ Req_New(const struct worker *wrk, struct sess *sp)
req->sp = sp; req->sp = sp;
req->top = req; // esi overrides req->top = req; // esi overrides
INIT_OBJ(req->htc, HTTP_CONN_MAGIC);
e = (char*)req + sz; e = (char*)req + sz;
p = (char*)(req + 1); p = (char*)(req + 1);
p = (void*)PRNDUP(p); p = (void*)PRNDUP(p);
......
...@@ -185,33 +185,13 @@ SES_Get_String_Attr(const struct sess *sp, enum sess_attr a) ...@@ -185,33 +185,13 @@ SES_Get_String_Attr(const struct sess *sp, enum sess_attr a)
void void
SES_RxInit(struct http_conn *htc, struct ws *ws) SES_RxInit(struct http_conn *htc, struct ws *ws)
{ {
ssize_t l;
htc->magic = HTTP_CONN_MAGIC; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
htc->ws = ws; htc->ws = ws;
(void)WS_Reserve(htc->ws, 0); (void)WS_Reserve(htc->ws, 0);
htc->rxbuf_b = ws->f; htc->rxbuf_b = ws->f;
htc->rxbuf_e = ws->f; htc->rxbuf_e = ws->f;
*htc->rxbuf_e = '\0';
htc->pipeline_b = NULL;
htc->pipeline_e = NULL;
}
/*--------------------------------------------------------------------
* Start over, and recycle any pipelined input.
* The WS_Reset is safe, even though the pipelined input is stored in
* the ws somewhere, because WS_Reset only fiddles pointers.
*/
void
SES_RxReInit(struct http_conn *htc)
{
ssize_t l;
CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
(void)WS_Reserve(htc->ws, 0);
htc->rxbuf_b = htc->ws->f;
htc->rxbuf_e = htc->ws->f;
if (htc->pipeline_b != NULL) { if (htc->pipeline_b != NULL) {
l = htc->pipeline_e - htc->pipeline_b; l = htc->pipeline_e - htc->pipeline_b;
assert(l > 0); assert(l > 0);
......
...@@ -112,6 +112,7 @@ http1_new_session(struct worker *wrk, void *arg) ...@@ -112,6 +112,7 @@ http1_new_session(struct worker *wrk, void *arg)
sp = req->sp; sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
SES_RxInit(req->htc, req->ws);
SES_Reserve_xport_priv(sp, &u); SES_Reserve_xport_priv(sp, &u);
http1_setstate(sp, H1NEWREQ); http1_setstate(sp, H1NEWREQ);
wrk->task.func = http1_req; wrk->task.func = http1_req;
...@@ -394,7 +395,7 @@ HTTP1_Session(struct worker *wrk, struct req *req) ...@@ -394,7 +395,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
} else if (st == H1CLEANUP) { } else if (st == H1CLEANUP) {
if (Req_Cleanup(sp, wrk, req)) if (Req_Cleanup(sp, wrk, req))
return; return;
SES_RxReInit(req->htc); SES_RxInit(req->htc, req->ws);
if (req->htc->rxbuf_e != req->htc->rxbuf_b) if (req->htc->rxbuf_e != req->htc->rxbuf_b)
wrk->stats->sess_readahead++; wrk->stats->sess_readahead++;
http1_setstate(sp, H1NEWREQ); http1_setstate(sp, H1NEWREQ);
......
...@@ -350,6 +350,7 @@ vpx_new_session(struct worker *wrk, void *arg) ...@@ -350,6 +350,7 @@ vpx_new_session(struct worker *wrk, void *arg)
assert(sizeof vpx1_sig == 5); assert(sizeof vpx1_sig == 5);
assert(sizeof vpx2_sig == 12); assert(sizeof vpx2_sig == 12);
SES_RxInit(req->htc, req->ws);
hs = SES_RxStuff(req->htc, vpx_complete, hs = SES_RxStuff(req->htc, vpx_complete,
NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle, NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle,
1024); // XXX ? 1024); // XXX ?
...@@ -376,7 +377,6 @@ vpx_new_session(struct worker *wrk, void *arg) ...@@ -376,7 +377,6 @@ vpx_new_session(struct worker *wrk, void *arg)
req->htc->pipeline_b = NULL; req->htc->pipeline_b = NULL;
else else
req->htc->pipeline_e = req->htc->rxbuf_e; req->htc->pipeline_e = req->htc->rxbuf_e;
SES_RxReInit(req->htc);
SES_SetTransport(wrk, sp, req, &HTTP1_transport); SES_SetTransport(wrk, sp, req, &HTTP1_transport);
} }
......
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