Commit 713d9997 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Dridi Boukelmoune

The rest of previous commit.

parent 7fb6cbcd
......@@ -370,12 +370,7 @@ vca_make_session(struct worker *wrk, void *arg)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CAST_OBJ_NOTNULL(wa, arg, WRK_ACCEPT_MAGIC);
if (VTCP_blocking(wa->acceptsock)) {
closefd(&wa->acceptsock);
wrk->stats->sess_drop++; // XXX Better counter ?
WS_Release(wrk->aws, 0);
return;
}
VTCP_blocking(wa->acceptsock);
/* Turn accepted socket into a session */
AN(wrk->aws->r);
......
......@@ -441,10 +441,7 @@ SES_Wait(struct sess *sp, const struct transport *xp)
* XXX: waiter_epoll prevents us from zeroing the struct because
* XXX: it keeps state across calls.
*/
if (VTCP_nonblocking(sp->fd)) {
SES_Delete(sp, SC_REM_CLOSE, NAN);
return;
}
VTCP_nonblocking(sp->fd);
/*
* put struct waited on the workspace
......
......@@ -177,30 +177,6 @@ http1_req_fail(struct req *req, enum sess_close reason)
SES_Close(req->sp, reason);
}
/*----------------------------------------------------------------------
*/
static int
http1_req_cleanup(struct sess *sp, struct worker *wrk, struct req *req)
{
AZ(wrk->aws->r);
AZ(req->ws->r);
Req_Cleanup(sp, wrk, req);
if (sp->fd >= 0 && req->doclose != SC_NULL)
SES_Close(sp, req->doclose);
if (sp->fd < 0) {
wrk->stats->sess_closed++;
AZ(req->vcl);
Req_Release(req);
SES_Delete(sp, SC_NULL, NAN);
return (1);
}
return (0);
}
static int v_matchproto_(vtr_minimal_response_f)
http1_minimal_response(struct req *req, uint16_t status)
{
......@@ -342,18 +318,9 @@ HTTP1_Session(struct worker *wrk, struct req *req)
* Whenever we come in from the acceptor or waiter, we need to set
* blocking mode. It would be simpler to do this in the acceptor
* or waiter, but we'd rather do the syscall in the worker thread.
* On systems which return errors for ioctl, we close early
*/
if (http1_getstate(sp) == H1NEWREQ && VTCP_blocking(sp->fd)) {
AN(req->htc->ws->r);
if (errno == ECONNRESET)
SES_Close(sp, SC_REM_CLOSE);
else
SES_Close(sp, SC_TX_ERROR);
WS_Release(req->htc->ws, 0);
AN(http1_req_cleanup(sp, wrk, req));
return;
}
if (http1_getstate(sp) == H1NEWREQ)
VTCP_blocking(sp->fd);
req->transport = &HTTP1_transport;
......@@ -455,8 +422,22 @@ HTTP1_Session(struct worker *wrk, struct req *req)
AZ(wrk->aws->r);
http1_setstate(sp, H1CLEANUP);
} else if (st == H1CLEANUP) {
if (http1_req_cleanup(sp, wrk, req))
AZ(wrk->aws->r);
AZ(req->ws->r);
if (sp->fd >= 0 && req->doclose != SC_NULL)
SES_Close(sp, req->doclose);
if (sp->fd < 0) {
wrk->stats->sess_closed++;
Req_Cleanup(sp, wrk, req);
Req_Release(req);
SES_Delete(sp, SC_NULL, NAN);
return;
}
Req_Cleanup(sp, wrk, req);
HTC_RxInit(req->htc, req->ws);
if (req->htc->rxbuf_e != req->htc->rxbuf_b)
wrk->stats->sess_readahead++;
......
......@@ -45,8 +45,8 @@ void VTCP_hisname(int sock, char *abuf, unsigned alen,
char *pbuf, unsigned plen);
int VTCP_filter_http(int sock);
int VTCP_fastopen(int sock, int depth);
int VTCP_blocking(int sock);
int VTCP_nonblocking(int sock);
void VTCP_blocking(int sock);
void VTCP_nonblocking(int sock);
int VTCP_linger(int sock, int linger);
int VTCP_check_hup(int sock);
......
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