[master] f0e30c5 Get a couple of SES_Close() moved back to the central code
Poul-Henning Kamp
phk at FreeBSD.org
Fri Feb 12 23:30:33 CET 2016
commit f0e30c574b2478fc5e44fc61441169646b314628
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Feb 12 21:06:58 2016 +0000
Get a couple of SES_Close() moved back to the central code
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 0718757..5879518 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -268,10 +268,11 @@ vbe_dir_getip(const struct director *d, struct worker *wrk,
/*--------------------------------------------------------------------*/
-static void
+static enum sess_close
vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
{
int i;
+ enum sess_close retval;
struct backend *bp;
struct v1p_acct v1a;
struct vbc *vbc;
@@ -293,7 +294,7 @@ vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
if (vbc == NULL) {
VSLb(bo->vsl, SLT_FetchError, "no backend connection");
- SES_Close(req->sp, SC_RX_TIMEOUT);
+ retval = SC_TX_ERROR;
} else {
i = V1F_SendReq(req->wrk, bo, &v1a.bereq, 1);
VSLb_ts_req(req, "Pipe", W_TIM_real(req->wrk));
@@ -302,11 +303,12 @@ vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
if (i == 0)
V1P_Process(req, vbc->fd, &v1a);
VSLb_ts_req(req, "PipeSess", W_TIM_real(req->wrk));
- SES_Close(req->sp, SC_TX_PIPE);
bo->htc->doclose = SC_TX_PIPE;
vbe_dir_finish(d, req->wrk, bo);
+ retval = SC_TX_PIPE;
}
V1P_Charge(req, &v1a, bp->vsc);
+ return (retval);
}
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c
index 9dac151..2fc5b5a 100644
--- a/bin/varnishd/cache/cache_director.c
+++ b/bin/varnishd/cache/cache_director.c
@@ -149,7 +149,7 @@ VDI_Finish(struct worker *wrk, struct busyobj *bo)
/* Get a connection --------------------------------------------------*/
-int
+enum sess_close
VDI_Http1Pipe(struct req *req, struct busyobj *bo)
{
const struct director *d;
@@ -158,10 +158,11 @@ VDI_Http1Pipe(struct req *req, struct busyobj *bo)
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
d = vdi_resolve(req->wrk, bo);
- if (d == NULL || d->http1pipe == NULL)
- return (-1);
- d->http1pipe(d, req, bo);
- return (0);
+ if (d == NULL || d->http1pipe == NULL) {
+ VSLb(bo->vsl, SLT_VCL_Error, "Backend does not support pipe");
+ return (SC_TX_ERROR);
+ }
+ return (d->http1pipe(d, req, bo));
}
/* Check health --------------------------------------------------------
diff --git a/bin/varnishd/cache/cache_director.h b/bin/varnishd/cache/cache_director.h
index cf20dc1..a02e086 100644
--- a/bin/varnishd/cache/cache_director.h
+++ b/bin/varnishd/cache/cache_director.h
@@ -58,7 +58,7 @@ typedef const struct suckaddr *vdi_getip_f(const struct director *,
typedef void vdi_finish_f(const struct director *, struct worker *,
struct busyobj *);
-typedef void vdi_http1pipe_f(const struct director *, struct req *,
+typedef enum sess_close vdi_http1pipe_f(const struct director *, struct req *,
struct busyobj *);
typedef void vdi_panic_f(const struct director *, struct vsb *);
@@ -88,7 +88,7 @@ const struct suckaddr *VDI_GetIP(struct worker *, struct busyobj *);
void VDI_Finish(struct worker *wrk, struct busyobj *bo);
-int VDI_Http1Pipe(struct req *, struct busyobj *);
+enum sess_close VDI_Http1Pipe(struct req *, struct busyobj *);
int VDI_Healthy(const struct director *, const struct busyobj *);
void VDI_Panic(const struct director *, struct vsb *, const char *nm);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index a0c0efd..22150d1 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -594,8 +594,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
INCOMPL();
assert(wrk->handling == VCL_RET_PIPE);
- if (VDI_Http1Pipe(req, bo) < 0)
- VSLb(bo->vsl, SLT_VCL_Error, "Backend does not support pipe");
+ SES_Close(req->sp, VDI_Http1Pipe(req, bo));
http_Teardown(bo->bereq);
VBO_ReleaseBusyObj(wrk, &bo);
THR_SetBusyobj(NULL);
diff --git a/bin/varnishtest/tests/r01730.vtc b/bin/varnishtest/tests/r01730.vtc
index e54a410..baef368 100644
--- a/bin/varnishtest/tests/r01730.vtc
+++ b/bin/varnishtest/tests/r01730.vtc
@@ -12,4 +12,4 @@ client c1 {
expect_close
} -run
-varnish v1 -expect sc_rx_timeout == 1
+varnish v1 -expect sc_tx_error == 1
More information about the varnish-commit
mailing list