Commit 45c1121a authored by Geoff Simmons's avatar Geoff Simmons

remove the add_probe() function, probe is now an optional argument

of the create() function
parent b97eab53
...@@ -37,5 +37,8 @@ varnish v1 -expect VBE.vcl1.be.bereq_hdrbytes > 0 ...@@ -37,5 +37,8 @@ varnish v1 -expect VBE.vcl1.be.bereq_hdrbytes > 0
varnish v1 -expect VBE.vcl1.be.bereq_bodybytes == 0 varnish v1 -expect VBE.vcl1.be.bereq_bodybytes == 0
varnish v1 -expect VBE.vcl1.be.beresp_hdrbytes == 38 varnish v1 -expect VBE.vcl1.be.beresp_hdrbytes == 38
varnish v1 -expect VBE.vcl1.be.beresp_bodybytes == 7 varnish v1 -expect VBE.vcl1.be.beresp_bodybytes == 7
varnish v1 -expect VBE.vcl1.be.happy == 0
varnish v1 -expect VBE.vcl1.be.req == 1
varnish v1 -expect VBE.vcl1.be.conn > 0
varnish v1 -expect s_resp_bodybytes == 7 varnish v1 -expect s_resp_bodybytes == 7
varnish v1 -expect s_resp_hdrbytes == 167 varnish v1 -expect s_resp_hdrbytes == 167
...@@ -32,3 +32,6 @@ client c1 { ...@@ -32,3 +32,6 @@ client c1 {
varnish v1 -cliok "backend.list -p" varnish v1 -cliok "backend.list -p"
varnish v1 -expect s_pipe == 1 varnish v1 -expect s_pipe == 1
varnish v1 -expect VBE.vcl1.be.happy == 0
varnish v1 -expect VBE.vcl1.be.req == 1
varnish v1 -expect VBE.vcl1.be.conn > 0
...@@ -47,3 +47,7 @@ client c1 { ...@@ -47,3 +47,7 @@ client c1 {
expect resp.status == 200 expect resp.status == 200
expect resp.bodylen == "8" expect resp.bodylen == "8"
} -run } -run
varnish v1 -expect VBE.vcl1.be.happy == 0
varnish v1 -expect VBE.vcl1.be.req == 2
varnish v1 -expect VBE.vcl1.be.conn > 0
...@@ -43,3 +43,4 @@ client c1 { ...@@ -43,3 +43,4 @@ client c1 {
} -run } -run
varnish v1 -expect sess_readahead == 2 varnish v1 -expect sess_readahead == 2
varnish v1 -expect VBE.vcl1.be.happy == 0
...@@ -49,3 +49,4 @@ client c1 { ...@@ -49,3 +49,4 @@ client c1 {
} -run } -run
varnish v1 -expect sess_readahead == 2 varnish v1 -expect sess_readahead == 2
varnish v1 -expect VBE.vcl1.be.happy == 0
...@@ -61,3 +61,5 @@ client c1 { ...@@ -61,3 +61,5 @@ client c1 {
rxresp rxresp
expect resp.http.X-Backend-Name == "s1" expect resp.http.X-Backend-Name == "s1"
} -run } -run
varnish v1 -expect VBE.vcl1.s1.happy == 0
...@@ -51,3 +51,5 @@ client c1 { ...@@ -51,3 +51,5 @@ client c1 {
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
} -run } -run
varnish v1 -expect VBE.vcl1.b1.happy == 0
...@@ -47,3 +47,5 @@ client c1 { ...@@ -47,3 +47,5 @@ client c1 {
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
} -run } -run
varnish v1 -expect VBE.vcl1.b1.happy == 0
...@@ -57,3 +57,6 @@ client c1 { ...@@ -57,3 +57,6 @@ client c1 {
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
} -run } -run
varnish v1 -expect VBE.vcl1.b1.happy == 0
varnish v1 -expect VBE.vcl1.b2.happy == 0
...@@ -45,3 +45,5 @@ client c1 { ...@@ -45,3 +45,5 @@ client c1 {
rxresp rxresp
expect resp.status == 503 expect resp.status == 503
} -run } -run
varnish v1 -expect VBE.vcl1.be.happy == 0
...@@ -36,3 +36,5 @@ client c1 { ...@@ -36,3 +36,5 @@ client c1 {
rxresp rxresp
expect resp.bodylen == 130000 expect resp.bodylen == 130000
} -run } -run
varnish v1 -expect VBE.vcl1.be.happy == 0
...@@ -46,3 +46,5 @@ client c1 { ...@@ -46,3 +46,5 @@ client c1 {
rxresp rxresp
send_urgent " " send_urgent " "
} -run } -run
varnish v1 -expect VBE.vcl1.be.happy == 0
...@@ -58,3 +58,5 @@ client c3 { ...@@ -58,3 +58,5 @@ client c3 {
client c1 -wait client c1 -wait
client c2 -wait client c2 -wait
client c3 -wait client c3 -wait
varnish v1 -expect VBE.vcl1.s0.happy == 0
...@@ -60,3 +60,4 @@ client c1 -wait ...@@ -60,3 +60,4 @@ client c1 -wait
varnish v1 -expect busy_sleep == 1 varnish v1 -expect busy_sleep == 1
varnish v1 -expect busy_wakeup == 1 varnish v1 -expect busy_wakeup == 1
varnish v1 -expect VBE.vcl1.be.happy == 0
...@@ -37,10 +37,8 @@ varnish v1 -vcl { ...@@ -37,10 +37,8 @@ varnish v1 -vcl {
sub vcl_init { sub vcl_init {
if (!backend_dyn.create(name="be", host="${s1_addr}", if (!backend_dyn.create(name="be", host="${s1_addr}",
port="${s1_port}")) { port="${s1_port}",
return(fail); probe=p)) {
}
if (!backend_dyn.add_probe(backend_dyn.by_name("be"), p)) {
return(fail); return(fail);
} }
} }
...@@ -49,3 +47,4 @@ varnish v1 -vcl { ...@@ -49,3 +47,4 @@ varnish v1 -vcl {
sema r1 sync 2 sema r1 sync 2
varnish v1 -cli "backend.list -p" varnish v1 -cli "backend.list -p"
varnish v1 -expect VBE.vcl1.be.happy > 0
...@@ -135,9 +135,10 @@ get_addrname(struct suckaddr *sa) ...@@ -135,9 +135,10 @@ get_addrname(struct suckaddr *sa)
VCL_BOOL VCL_BOOL
vmod_create(VRT_CTX, struct vmod_priv *priv, VCL_STRING vcl_name, vmod_create(VRT_CTX, struct vmod_priv *priv, VCL_STRING vcl_name,
VCL_STRING host, VCL_STRING port, VCL_STRING host_header, VCL_STRING host, VCL_STRING port, VCL_PROBE probe,
VCL_DURATION connect_timeout, VCL_DURATION first_byte_timeout, VCL_STRING host_header, VCL_DURATION connect_timeout,
VCL_DURATION between_bytes_timeout, VCL_INT max_connections) VCL_DURATION first_byte_timeout, VCL_DURATION between_bytes_timeout,
VCL_INT max_connections)
{ {
struct belist *belist; struct belist *belist;
struct bentry *bentry; struct bentry *bentry;
...@@ -205,6 +206,19 @@ vmod_create(VRT_CTX, struct vmod_priv *priv, VCL_STRING vcl_name, ...@@ -205,6 +206,19 @@ vmod_create(VRT_CTX, struct vmod_priv *priv, VCL_STRING vcl_name,
dir = VRT_new_backend(ctx, &be); dir = VRT_new_backend(ctx, &be);
CHECK_OBJ_NOTNULL(dir, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(dir, DIRECTOR_MAGIC);
if (probe != NULL) {
struct backend *backend;
struct tcp_pool *tpool;
CAST_OBJ_NOTNULL(backend, dir->priv, BACKEND_MAGIC);
AZ(backend->probe);
tpool = VBT_Ref(sa4, sa6);
AN(tpool);
VBP_Insert(backend, probe, tpool);
AN(backend->probe);
}
ALLOC_OBJ(bentry, BENTRY_MAGIC); ALLOC_OBJ(bentry, BENTRY_MAGIC);
AN(bentry); AN(bentry);
bentry->be = dir; bentry->be = dir;
...@@ -286,22 +300,6 @@ vmod_delete(VRT_CTX, struct vmod_priv *priv, VCL_BACKEND be) ...@@ -286,22 +300,6 @@ vmod_delete(VRT_CTX, struct vmod_priv *priv, VCL_BACKEND be)
return 1; return 1;
} }
VCL_BOOL
vmod_add_probe(VRT_CTX, VCL_BACKEND be, VCL_PROBE probe)
{
struct backend *backend;
CHECK_OBJ_NOTNULL(probe, VRT_BACKEND_PROBE_MAGIC);
backend = check_and_get_backend(ctx, be);
if (backend == NULL)
return 0;
if (backend->probe != NULL)
VBP_Remove(backend);
VBP_Insert(backend, probe, backend->tcp_pool);
AN(backend->probe);
return 1;
}
VCL_BOOL VCL_BOOL
vmod_remove_probe(VRT_CTX, VCL_BACKEND be) vmod_remove_probe(VRT_CTX, VCL_BACKEND be)
{ {
......
...@@ -16,8 +16,8 @@ This is the embedded documentation for the example VMOD. It should ...@@ -16,8 +16,8 @@ This is the embedded documentation for the example VMOD. It should
mention what the vmod is intended to do. mention what the vmod is intended to do.
$Function BOOL create(PRIV_VCL, STRING name, STRING host, STRING port="", $Function BOOL create(PRIV_VCL, STRING name, STRING host, STRING port="",
STRING host_header="", DURATION connect_timeout=0, PROBE probe=0, STRING host_header="",
DURATION first_byte_timeout=0, DURATION connect_timeout=0, DURATION first_byte_timeout=0,
DURATION between_bytes_timeout=0, DURATION between_bytes_timeout=0,
INT max_connections=0) INT max_connections=0)
...@@ -25,8 +25,6 @@ $Function BACKEND by_name(PRIV_VCL, STRING name) ...@@ -25,8 +25,6 @@ $Function BACKEND by_name(PRIV_VCL, STRING name)
$Function BOOL delete(PRIV_VCL, BACKEND be) $Function BOOL delete(PRIV_VCL, BACKEND be)
$Function BOOL add_probe(BACKEND be, PROBE probe)
$Function BOOL remove_probe(BACKEND be) $Function BOOL remove_probe(BACKEND be)
$Function BOOL stop_probe(BACKEND be) $Function BOOL stop_probe(BACKEND be)
......
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