Commit 746b4da3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move bo->doclose to bo->htc->doclose which is more correct.

parent bd702410
...@@ -225,6 +225,7 @@ struct http_conn { ...@@ -225,6 +225,7 @@ struct http_conn {
#define HTTP_CONN_MAGIC 0x3e19edd1 #define HTTP_CONN_MAGIC 0x3e19edd1
int fd; int fd;
enum sess_close doclose;
unsigned maxbytes; unsigned maxbytes;
unsigned maxhdr; unsigned maxhdr;
struct ws *ws; struct ws *ws;
...@@ -481,8 +482,6 @@ struct busyobj { ...@@ -481,8 +482,6 @@ struct busyobj {
struct pool_task fetch_task; struct pool_task fetch_task;
enum sess_close doclose;
#define BO_FLAG(l, r, w, d) unsigned l:1; #define BO_FLAG(l, r, w, d) unsigned l:1;
#include "tbl/bo_flags.h" #include "tbl/bo_flags.h"
#undef BO_FLAG #undef BO_FLAG
......
...@@ -109,6 +109,7 @@ vbe_dir_getfd(struct worker *wrk, const struct director *d, struct busyobj *bo) ...@@ -109,6 +109,7 @@ vbe_dir_getfd(struct worker *wrk, const struct director *d, struct busyobj *bo)
if (bo->htc == NULL) if (bo->htc == NULL)
/* XXX: counter ? */ /* XXX: counter ? */
return (-1); return (-1);
bo->htc->doclose = SC_NULL;
FIND_TMO(connect_timeout, tmod, bo, bp); FIND_TMO(connect_timeout, tmod, bo, bp);
vc = VBT_Get(bp->tcp_pool, tmod, bp, wrk); vc = VBT_Get(bp->tcp_pool, tmod, bp, wrk);
...@@ -176,7 +177,7 @@ vbe_dir_finish(const struct director *d, struct worker *wrk, ...@@ -176,7 +177,7 @@ vbe_dir_finish(const struct director *d, struct worker *wrk,
VBT_Wait(wrk, bo->htc->vbc); VBT_Wait(wrk, bo->htc->vbc);
CHECK_OBJ_NOTNULL(bo->htc->vbc->backend, BACKEND_MAGIC); CHECK_OBJ_NOTNULL(bo->htc->vbc->backend, BACKEND_MAGIC);
bo->htc->vbc->backend = NULL; bo->htc->vbc->backend = NULL;
if (bo->doclose != SC_NULL) { if (bo->htc->doclose != SC_NULL) {
VSLb(bo->vsl, SLT_BackendClose, "%d %s", bo->htc->vbc->fd, VSLb(bo->vsl, SLT_BackendClose, "%d %s", bo->htc->vbc->fd,
bp->display_name); bp->display_name);
VBT_Close(bp->tcp_pool, &bo->htc->vbc); VBT_Close(bp->tcp_pool, &bo->htc->vbc);
...@@ -237,7 +238,6 @@ vbe_dir_gethdrs(const struct director *d, struct worker *wrk, ...@@ -237,7 +238,6 @@ vbe_dir_gethdrs(const struct director *d, struct worker *wrk,
bo->req->req_body_status != REQ_BODY_CACHED) bo->req->req_body_status != REQ_BODY_CACHED)
break; break;
VSC_C_main->backend_retry++; VSC_C_main->backend_retry++;
bo->doclose = SC_NULL;
} while (extrachance); } while (extrachance);
return (-1); return (-1);
} }
......
...@@ -143,7 +143,6 @@ VBO_GetBusyObj(struct worker *wrk, const struct req *req) ...@@ -143,7 +143,6 @@ VBO_GetBusyObj(struct worker *wrk, const struct req *req)
VCL_Ref(bo->vcl); VCL_Ref(bo->vcl);
bo->t_first = bo->t_prev = NAN; bo->t_first = bo->t_prev = NAN;
bo->doclose = SC_NULL;
memcpy(bo->digest, req->digest, sizeof bo->digest); memcpy(bo->digest, req->digest, sizeof bo->digest);
......
...@@ -169,7 +169,6 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) ...@@ -169,7 +169,6 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo)
CHECK_OBJ_NOTNULL(bo->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(bo->req, REQ_MAGIC);
assert(bo->state == BOS_INVALID); assert(bo->state == BOS_INVALID);
assert(bo->doclose == SC_NULL);
AZ(bo->storage_hint); AZ(bo->storage_hint);
HTTP_Setup(bo->bereq0, bo->ws, bo->vsl, SLT_BereqMethod); HTTP_Setup(bo->bereq0, bo->ws, bo->vsl, SLT_BereqMethod);
...@@ -228,7 +227,6 @@ vbf_stp_retry(struct worker *wrk, struct busyobj *bo) ...@@ -228,7 +227,6 @@ vbf_stp_retry(struct worker *wrk, struct busyobj *bo)
/* VDI_Finish must have been called before */ /* VDI_Finish must have been called before */
assert(bo->director_state == DIR_S_NULL); assert(bo->director_state == DIR_S_NULL);
bo->doclose = SC_NULL;
/* reset other bo attributes - See VBO_GetBusyObj */ /* reset other bo attributes - See VBO_GetBusyObj */
bo->storage_hint = NULL; bo->storage_hint = NULL;
...@@ -261,7 +259,6 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) ...@@ -261,7 +259,6 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
assert(bo->doclose == SC_NULL);
AZ(bo->storage_hint); AZ(bo->storage_hint);
if (bo->do_pass) if (bo->do_pass)
...@@ -372,7 +369,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) ...@@ -372,7 +369,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
} }
if (bo->htc->body_status == BS_ERROR) { if (bo->htc->body_status == BS_ERROR) {
bo->doclose = SC_RX_BODY; bo->htc->doclose = SC_RX_BODY;
VDI_Finish(bo->wrk, bo); VDI_Finish(bo->wrk, bo);
VSLb(bo->vsl, SLT_Error, "Body cannot be fetched"); VSLb(bo->vsl, SLT_Error, "Body cannot be fetched");
assert(bo->director_state == DIR_S_NULL); assert(bo->director_state == DIR_S_NULL);
...@@ -414,7 +411,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) ...@@ -414,7 +411,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
*/ */
VSLb(bo->vsl, SLT_Error, VSLb(bo->vsl, SLT_Error,
"304 response but not conditional fetch"); "304 response but not conditional fetch");
bo->doclose = SC_RX_BAD; bo->htc->doclose = SC_RX_BAD;
VDI_Finish(bo->wrk, bo); VDI_Finish(bo->wrk, bo);
return (F_STP_FAIL); return (F_STP_FAIL);
} }
...@@ -429,14 +426,14 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) ...@@ -429,14 +426,14 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
VCL_backend_response_method(bo->vcl, wrk, NULL, bo, NULL); VCL_backend_response_method(bo->vcl, wrk, NULL, bo, NULL);
if (wrk->handling == VCL_RET_ABANDON) { if (wrk->handling == VCL_RET_ABANDON) {
bo->doclose = SC_RESP_CLOSE; bo->htc->doclose = SC_RESP_CLOSE;
VDI_Finish(bo->wrk, bo); VDI_Finish(bo->wrk, bo);
return (F_STP_FAIL); return (F_STP_FAIL);
} }
if (wrk->handling == VCL_RET_RETRY) { if (wrk->handling == VCL_RET_RETRY) {
if (bo->htc->body_status != BS_NONE) if (bo->htc->body_status != BS_NONE)
bo->doclose = SC_RESP_CLOSE; bo->htc->doclose = SC_RESP_CLOSE;
if (bo->director_state != DIR_S_NULL) if (bo->director_state != DIR_S_NULL)
VDI_Finish(bo->wrk, bo); VDI_Finish(bo->wrk, bo);
...@@ -494,14 +491,14 @@ vbf_fetch_body_helper(struct busyobj *bo) ...@@ -494,14 +491,14 @@ vbf_fetch_body_helper(struct busyobj *bo)
VSLb(vfc->wrk->vsl, SLT_FetchError, VSLb(vfc->wrk->vsl, SLT_FetchError,
"Pass delivery abandoned"); "Pass delivery abandoned");
vfps = VFP_END; vfps = VFP_END;
bo->doclose = SC_RX_BODY; bo->htc->doclose = SC_RX_BODY;
break; break;
} }
AZ(vfc->failed); AZ(vfc->failed);
l = est; l = est;
assert(l >= 0); assert(l >= 0);
if (VFP_GetStorage(vfc, &l, &ptr) != VFP_OK) { if (VFP_GetStorage(vfc, &l, &ptr) != VFP_OK) {
bo->doclose = SC_RX_BODY; bo->htc->doclose = SC_RX_BODY;
break; break;
} }
...@@ -522,7 +519,7 @@ vbf_fetch_body_helper(struct busyobj *bo) ...@@ -522,7 +519,7 @@ vbf_fetch_body_helper(struct busyobj *bo)
if (vfps == VFP_ERROR) { if (vfps == VFP_ERROR) {
AN(vfc->failed); AN(vfc->failed);
(void)VFP_Error(vfc, "Fetch pipeline failed to process"); (void)VFP_Error(vfc, "Fetch pipeline failed to process");
bo->doclose = SC_RX_BODY; bo->htc->doclose = SC_RX_BODY;
} }
if (!bo->do_stream) if (!bo->do_stream)
...@@ -612,14 +609,14 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) ...@@ -612,14 +609,14 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if (VFP_Open(bo->vfc)) { if (VFP_Open(bo->vfc)) {
(void)VFP_Error(bo->vfc, "Fetch pipeline failed to open"); (void)VFP_Error(bo->vfc, "Fetch pipeline failed to open");
bo->doclose = SC_RX_BODY; bo->htc->doclose = SC_RX_BODY;
VDI_Finish(bo->wrk, bo); VDI_Finish(bo->wrk, bo);
return (F_STP_ERROR); return (F_STP_ERROR);
} }
if (vbf_beresp2obj(bo)) { if (vbf_beresp2obj(bo)) {
(void)VFP_Error(bo->vfc, "Could not get storage"); (void)VFP_Error(bo->vfc, "Could not get storage");
bo->doclose = SC_RX_BODY; bo->htc->doclose = SC_RX_BODY;
VDI_Finish(bo->wrk, bo); VDI_Finish(bo->wrk, bo);
return (F_STP_ERROR); return (F_STP_ERROR);
} }
...@@ -809,9 +806,10 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo) ...@@ -809,9 +806,10 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
wrk->handling == VCL_RET_ABANDON) { wrk->handling == VCL_RET_ABANDON) {
VSB_delete(synth_body); VSB_delete(synth_body);
bo->doclose = SC_RESP_CLOSE; if (bo->director_state != DIR_S_NULL) {
if (bo->director_state != DIR_S_NULL) bo->htc->doclose = SC_RESP_CLOSE;
VDI_Finish(bo->wrk, bo); VDI_Finish(bo->wrk, bo);
}
if (wrk->handling == VCL_RET_RETRY && if (wrk->handling == VCL_RET_RETRY &&
bo->retries++ < cache_param->max_retries) bo->retries++ < cache_param->max_retries)
...@@ -897,7 +895,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv) ...@@ -897,7 +895,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
THR_SetBusyobj(bo); THR_SetBusyobj(bo);
stp = F_STP_MKBEREQ; stp = F_STP_MKBEREQ;
assert(bo->doclose == SC_NULL);
assert(isnan(bo->t_first)); assert(isnan(bo->t_first));
assert(isnan(bo->t_prev)); assert(isnan(bo->t_prev));
VSLb_ts_busyobj(bo, "Start", W_TIM_real(wrk)); VSLb_ts_busyobj(bo, "Start", W_TIM_real(wrk));
......
...@@ -135,7 +135,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host) ...@@ -135,7 +135,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
VSLb(bo->vsl, SLT_FetchError, "backend write error: %d (%s)", VSLb(bo->vsl, SLT_FetchError, "backend write error: %d (%s)",
errno, strerror(errno)); errno, strerror(errno));
VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk)); VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk));
bo->doclose = SC_TX_ERROR; htc->doclose = SC_TX_ERROR;
return (1); return (1);
} }
VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk)); VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk));
...@@ -168,7 +168,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host) ...@@ -168,7 +168,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
VSLb(bo->vsl, SLT_FetchError, VSLb(bo->vsl, SLT_FetchError,
"http %sread error: overflow", "http %sread error: overflow",
first ? "first " : ""); first ? "first " : "");
bo->doclose = SC_RX_OVERFLOW; htc->doclose = SC_RX_OVERFLOW;
return (-1); return (-1);
} }
if (hs == HTC_S_EOF) { if (hs == HTC_S_EOF) {
...@@ -177,7 +177,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host) ...@@ -177,7 +177,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
htc->rxbuf_e - htc->rxbuf_b; htc->rxbuf_e - htc->rxbuf_b;
VSLb(bo->vsl, SLT_FetchError, "http %sread error: EOF", VSLb(bo->vsl, SLT_FetchError, "http %sread error: EOF",
first ? "first " : ""); first ? "first " : "");
bo->doclose = SC_RX_TIMEOUT; htc->doclose = SC_RX_TIMEOUT;
return (first ? 1 : -1); return (first ? 1 : -1);
} }
if (first) { if (first) {
...@@ -192,11 +192,11 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host) ...@@ -192,11 +192,11 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
if (HTTP1_DissectResponse(hp, htc)) { if (HTTP1_DissectResponse(hp, htc)) {
VSLb(bo->vsl, SLT_FetchError, "http format error"); VSLb(bo->vsl, SLT_FetchError, "http format error");
bo->doclose = SC_RX_JUNK; htc->doclose = SC_RX_JUNK;
return (-1); return (-1);
} }
bo->doclose = http_DoConnection(hp); htc->doclose = http_DoConnection(hp);
return (0); return (0);
} }
...@@ -172,7 +172,7 @@ V1P_Process(struct req *req, struct busyobj *bo, int fd) ...@@ -172,7 +172,7 @@ V1P_Process(struct req *req, struct busyobj *bo, int fd)
VSLb_ts_req(req, "PipeSess", W_TIM_real(wrk)); VSLb_ts_req(req, "PipeSess", W_TIM_real(wrk));
pipecharge(req, &acct_pipe, bo->htc->vbc->backend->vsc); pipecharge(req, &acct_pipe, bo->htc->vbc->backend->vsc);
SES_Close(req->sp, SC_TX_PIPE); SES_Close(req->sp, SC_TX_PIPE);
bo->doclose = SC_TX_PIPE; bo->htc->doclose = SC_TX_PIPE;
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
......
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