Commit 75e2bac1 authored by Nils Goroll's avatar Nils Goroll

Initial version of the weightadjust director, tested with varnish-cache master

parent 49e91500
Pipeline #297 skipped
This is free and unencumbered software released into the public domain. Copyright 2017 UPLEX Nils Goroll Systemoptimierung
Portions Copyright (c) 2013-2015 Varnish Software AS
Portions Copyright (c) 2006 Verdens Gang AS
All rights reserved.
Anyone is free to copy, modify, publish, use, compile, sell, or Redistribution and use in source and binary forms, with or without
distribute this software, either in source code form or as a compiled modification, are permitted provided that the following conditions
binary, for any purpose, commercial or non-commercial, and by any are met:
means. 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
In jurisdictions that recognize copyright laws, the author or authors THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
of this software dedicate any and all copyright interest in the ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
software to the public domain. We make this dedication for the benefit IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
of the public at large and to the detriment of our heirs and ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
successors. We intend this dedication to be an overt act of FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
relinquishment in perpetuity of all present and future rights to this DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
software under copyright law. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. SUCH DAMAGE.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
AC_PREREQ([2.68]) AC_PREREQ([2.68])
AC_INIT([libvmod-weightadjust], [0.1], [], [vmod-weightadjust]) AC_INIT([libvmod-weightadjust], [0.1], [], [vmod-weightadjust])
AC_COPYRIGHT([2013-2015 Varnish Software AS, 2017 UPLEX Nils Goroll Systemoptimierung]) AC_COPYRIGHT([2017 UPLEX Nils Goroll Systemoptimierung and others])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR(src/vmod_weightadjust.vcc) AC_CONFIG_SRCDIR(src/vmod_weightadjust.vcc)
......
...@@ -7,7 +7,11 @@ libvmod_weightadjust_la_SOURCES = \ ...@@ -7,7 +7,11 @@ libvmod_weightadjust_la_SOURCES = \
vdir.c \ vdir.c \
vdir.h \ vdir.h \
random.c \ random.c \
vmod_weightadjust.c vmod_weightadjust.c \
vmod_weightadjust.h \
wadj_thread.c \
wadj_thread.h \
wadj_prop.h
nodist_libvmod_weightadjust_la_SOURCES = \ nodist_libvmod_weightadjust_la_SOURCES = \
vcc_weightadjust_if.c \ vcc_weightadjust_if.c \
......
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
#include "vdir.h" #include "vdir.h"
#include "vcc_if.h" #include "vcc_weightadjust_if.h"
#include "vmod_weightadjust.h"
struct vmod_directors_random { #define vmod_directors_random vmod_weightadjust_random
unsigned magic; #define VMOD_DIRECTORS_RANDOM_MAGIC VMOD_WEIGHTADJUST_RANDOM_MAGIC
#define VMOD_DIRECTORS_RANDOM_MAGIC 0x4732d092 #define vmod_random__init _vmod_random__init
struct vdir *vd; #define vmod_random__fini _vmod_random__fini
};
static unsigned __match_proto__(vdi_healthy) static unsigned __match_proto__(vdi_healthy)
vmod_random_healthy(const struct director *dir, const struct busyobj *bo, vmod_random_healthy(const struct director *dir, const struct busyobj *bo,
...@@ -103,6 +103,7 @@ vmod_random__fini(struct vmod_directors_random **rrp) ...@@ -103,6 +103,7 @@ vmod_random__fini(struct vmod_directors_random **rrp)
FREE_OBJ(rr); FREE_OBJ(rr);
} }
#ifdef UNUSED
VCL_VOID __match_proto__() VCL_VOID __match_proto__()
vmod_random_add_backend(VRT_CTX, vmod_random_add_backend(VRT_CTX,
struct vmod_directors_random *rr, VCL_BACKEND be, double w) struct vmod_directors_random *rr, VCL_BACKEND be, double w)
...@@ -120,6 +121,7 @@ VCL_VOID vmod_random_remove_backend(VRT_CTX, ...@@ -120,6 +121,7 @@ VCL_VOID vmod_random_remove_backend(VRT_CTX,
CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_RANDOM_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_RANDOM_MAGIC);
vdir_remove_backend(rr->vd, be, NULL); vdir_remove_backend(rr->vd, be, NULL);
} }
#endif
VCL_BACKEND __match_proto__() VCL_BACKEND __match_proto__()
vmod_random_backend(VRT_CTX, struct vmod_directors_random *rr) vmod_random_backend(VRT_CTX, struct vmod_directors_random *rr)
......
...@@ -8,10 +8,10 @@ server s1 { ...@@ -8,10 +8,10 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors; import ${vmod_weightadjust};
sub vcl_init { sub vcl_init {
new foo = directors.random(); new foo = weightadjust.random();
foo.add_backend(s1, 1); foo.add_backend(s1, 1);
foo.add_backend(s1, 1); foo.add_backend(s1, 1);
} }
...@@ -43,10 +43,10 @@ server s2 { ...@@ -43,10 +43,10 @@ server s2 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors; import ${vmod_weightadjust};
sub vcl_init { sub vcl_init {
new foo = directors.random(); new foo = weightadjust.random();
foo.add_backend(s1, 1); foo.add_backend(s1, 1);
foo.add_backend(s2, 1); foo.add_backend(s2, 1);
} }
......
...@@ -33,10 +33,10 @@ server s4 { ...@@ -33,10 +33,10 @@ server s4 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import directors; import ${vmod_weightadjust};
sub vcl_init { sub vcl_init {
new foo = directors.random(); new foo = weightadjust.random();
foo.add_backend(s1, 1); foo.add_backend(s1, 1);
foo.add_backend(s2, 1); foo.add_backend(s2, 1);
foo.add_backend(s3, 1); foo.add_backend(s3, 1);
......
This diff is collapsed.
/*-
* Copyright 2017 UPLEX Nils Goroll Systemoptimierung
* All rights reserved.
*
* Author: Nils Goroll <nils.goroll@uplex.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "wadj_prop.h"
struct vmod_wadj_vcl;
struct vmod_wadj_extra {
struct vmod_wadj_vcl *wa_vcl;
struct wadj_prop_head props;
int updates;
};
struct vmod_weightadjust_random {
unsigned magic;
#define VMOD_WEIGHTADJUST_RANDOM_MAGIC 0xea90ee21
struct vdir *vd;
struct vmod_wadj_extra extra;
};
/*
* code from varnish-cache vmod_directors random.c
*
* original symbol-names #define replaced to those used here
*/
VCL_VOID _vmod_random__init(VRT_CTX, struct vmod_weightadjust_random **rrp,
const char *vcl_name);
VCL_VOID _vmod_random__fini(struct vmod_weightadjust_random **rrp);
...@@ -11,7 +11,7 @@ DESCRIPTION ...@@ -11,7 +11,7 @@ DESCRIPTION
$Event event_function $Event event_function
$Object random() $Object random(PRIV_VCL)
Description Description
Create a random backend director. Create a random backend director.
......
struct vmod_wadj_prop;
VTAILQ_HEAD(wadj_prop_head,wadj_prop);
/*-
* Copyright 2017 UPLEX Nils Goroll Systemoptimierung
*
* All rights reserved.
*
* Author: Nils Goroll <nils.goroll@uplex.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <poll.h>
#include <sys/socket.h>
#include <errno.h>
#include <limits.h>
#include <pcre.h>
#include "cache/cache.h"
#include "vrt.h"
#include "vre.h"
#include "vsa.h"
#include "vtim.h"
#include "vtcp.h"
#include "waiter/waiter.h"
#include "cache/cache_director.h"
#include "cache/cache_backend.h"
#include "vdir.h"
#include "wadj_prop.h"
#include "wadj_thread.h"
#define POKE_ERR(prop, fmt, ...) \
VSL(SLT_VCL_Error, 0, "vmod weightadjust error: poke %s.%s " fmt, \
(prop)->vd->dir->vcl_name, (prop)->be->display_name, \
__VA_ARGS__)
#define VPOKE_TRACE(prop, fmt, ...) \
VSL(SLT_Debug, 0, "vmod weightadjust: poke %s.%s " fmt, \
(prop)->vd->dir->vcl_name, (prop)->be->display_name, \
__VA_ARGS__)
#define POKE_TRACE(prop, str) \
VSL(SLT_Debug, 0, "vmod weightadjust: poke %s.%s " str, \
(prop)->vd->dir->vcl_name, (prop)->be->display_name)
/* largely copied from vbp_poke */
static void
wadj_poke(const struct wadj_prop *prop, char *buf,
unsigned *len)
{
int s, tmo, i;
double t_start, t_now, t_end;
unsigned rlen;
struct pollfd pfda[1], *pfd = pfda;
const struct suckaddr *sa;
// pcre JIT requires 32K anyway, and we are not running when it is
char drain[32*1024];
t_start = t_now = VTIM_real();
t_end = t_start + prop->timeout;
*buf = '\0';
*len = 0;
s = VBT_Open(prop->be->tcp_pool, t_end - t_now, &sa);
if (s < 0) {
POKE_ERR(prop, "no connection %s", strerror(errno));
return;
}
i = VSA_Get_Proto(sa);
assert(i == AF_INET || i == AF_INET6);
t_now = VTIM_real();
tmo = (int)round((t_end - t_now) * 1e3);
if (tmo <= 0) {
POKE_ERR(prop, "connection timeout after %fs",
t_now - t_start);
VTCP_close(&s);
return;
}
i = write(s, prop->req, prop->reqlen);
if (i != prop->reqlen) {
POKE_ERR(prop, "short write (%d out of %d bytes)",
i, prop->reqlen);
VTCP_close(&s);
return;
}
pfd->fd = s;
rlen = 0;
do {
pfd->events = POLLIN;
pfd->revents = 0;
tmo = (int)round((t_end - t_now) * 1e3);
if (tmo > 0)
i = poll(pfd, 1, tmo);
if (i == 0 || tmo <= 0) {
POKE_ERR(prop, "read timeout after %fs",
VTIM_real() - t_start);
VTCP_close(&s);
return;
}
if (rlen < prop->bufsz)
i = read(s, buf + rlen, prop->bufsz - rlen);
else
i = read(s, drain, sizeof(drain));
if (i <= 0)
break;
if (rlen < prop->bufsz)
rlen += i;
} while (1);
VTCP_close(&s);
if (rlen < prop->bufsz)
buf[rlen] = '\0';
else {
assert(rlen == prop->bufsz);
buf[--rlen] = '\0';
}
*len = rlen;
if (i < 0)
POKE_ERR(prop, "read error: %s", strerror(errno));
}
static void *
wadj_update(void *arg)
{
const struct wadj_prop *pr;
CAST_OBJ_NOTNULL(pr, arg, WADJ_PROP_MAGIC);
struct vdir *vd;
double t, due;
unsigned u = UINT_MAX;
const int ovsz = 2 * 3;
int i, ov[ovsz];
char *p, *pp;
AN(pr->bufsz);
char buf[pr->bufsz];
unsigned len;
double w;
AN(pr->vd);
vd = pr->vd;
AN(pr->be);
AN(pr->vre);
AN(pr->req);
AN(pr->req[0]);
POKE_TRACE(pr, "starting");
due = VTIM_mono();
while (pr->run >= STARTING) {
t = VTIM_mono();
if (t < due) {
VTIM_sleep(due - t);
continue;
}
due += pr->interval;
wadj_poke(pr, buf, &len);
if (pr->run < STARTING)
break;
if (len == 0)
continue;
assert(len <= pr->bufsz);
i = VRE_exec(pr->vre, buf, len, 0, PCRE_NEWLINE_ANYCRLF,
ov, ovsz, NULL);
if (i < 0) {
POKE_ERR(pr, "regular expression error %d", i);
continue;
}
if (i != 2) {
POKE_ERR(pr, "regular expression "
"need one caputuring match, got %d", i - 1);
continue;
}
assert(ov[2] < len);
assert(ov[3] < len);
p = buf + ov[2];
buf[ov[3]] = '\0';
errno = 0;
w = strtod(p, &pp);
if (pp == p || w == 0.0 || w == HUGE_VALF || w == HUGE_VALL) {
POKE_ERR(pr, "conversion error or zero value %f "
"(errno %d) for: %s", w, errno, p);
continue;
}
if (w < 0) {
POKE_ERR(pr, "negative weight %f", w);
continue;
}
vdir_wrlock(vd);
if (u >= vd->n_backend ||
vd->backend[u]->priv != pr->be) {
/* we got moved around */
for (u = 0; u < vd->n_backend; u++) {
if (vd->backend[u]->priv == pr->be)
break;
}
assert(u < vd->n_backend); // assert(found)
}
vd->total_weight += w - vd->weight[u];
vd->weight[u] = w;
/* arbitrary safety measure against precision loss */
if ((*pr->vd_updates)++ > 128) {
*pr->vd_updates = 0;
vd->total_weight = 0;
for (u = 0; u < vd->n_backend; u++)
vd->total_weight += vd->weight[u];
VPOKE_TRACE(pr, "recalc total %f", vd->total_weight);
}
VPOKE_TRACE(pr, "set to %f total %f", w, vd->total_weight);
vdir_unlock(vd);
}
POKE_TRACE(pr, "stopping");
return NULL;
}
static void
wadj_thr_start(struct wadj_prop *prop)
{
pthread_attr_t attr;
if (prop->run >= STARTING)
return;
AZ(pthread_attr_init(&attr));
// 32K JIT + 32K general + buf
AZ(pthread_attr_setstacksize(&attr, 64 * 1024 + prop->bufsz));
prop->run = STARTING;
AZ(pthread_create(&prop->thread, &attr, wadj_update, prop));
prop->run = RUNNING;
AZ(pthread_attr_destroy(&attr));
}
static void
wadj_thr_stop(struct wadj_prop *prop)
{
if (prop->run <= STOPPED)
return;
prop->run = STOPPING;
AZ(pthread_join(prop->thread, NULL));
prop->run = STOPPED;
}
/* wa_vcl->mtx must be held */
void
wadj_thr_ctl(struct vmod_wadj_vcl *wa_vcl,
struct wadj_prop *prop, enum wadj_thr_action_e action)
{
if (wa_vcl->state == VCL_EVENT_LOAD ||
wa_vcl->state == VCL_EVENT_DISCARD)
return;
if (prop) {
if (wa_vcl->state == VCL_EVENT_WARM) {
if (action == START || action == DEFAULT)
return wadj_thr_start(prop);
else
return wadj_thr_stop(prop);
}
assert(wa_vcl->state == VCL_EVENT_COLD);
return wadj_thr_stop(prop);
}
assert(prop == NULL);
assert(action == DEFAULT);
if (wa_vcl->state == VCL_EVENT_WARM) {
VTAILQ_FOREACH(prop, &wa_vcl->props, list_vcl) {
wadj_thr_start(prop);
}
return;
}
assert(wa_vcl->state == VCL_EVENT_COLD);
VTAILQ_FOREACH(prop, &wa_vcl->props, list_vcl) {
if (prop->run <= STOPPING)
break;
assert(prop->run == RUNNING);
prop->run = STOPPING;
}
VTAILQ_FOREACH(prop, &wa_vcl->props, list_vcl) {
if (prop->run != STOPPING)
break;
AZ(pthread_join(prop->thread, NULL));
prop->run = STOPPED;
}
}
/* detruct prop */
void
wadj_prop_fini(struct wadj_prop **propp)
{
struct wadj_prop *prop;
prop = *propp;
*propp = NULL;
CHECK_OBJ_NOTNULL(prop, WADJ_PROP_MAGIC);
assert(prop->run == STOPPED);
AN(prop->vre);
VRE_free(&prop->vre);
AN(prop->req);
free(prop->req);
FREE_OBJ(prop);
}
/*
* stop all threads and fini all props of a director
*
* removes only from vcl_prop, not from vd_props
*
* wa_vcl->mtx must be held
*/
void
wadj_dir_fini(const struct wadj_prop_head *vd_props,
struct wadj_prop_head *vcl_props)
{
struct wadj_prop *prop, *save;
VTAILQ_FOREACH(prop, vd_props, list_vd) {
if (prop->run <= STOPPING)
break;
assert(prop->run == RUNNING);
prop->run = STOPPING;
}
VTAILQ_FOREACH_SAFE(prop, vd_props, list_vd, save) {
VTAILQ_REMOVE(vcl_props, prop, list_vcl);
if (prop->run == STOPPING) {
AZ(pthread_join(prop->thread, NULL));
prop->run = STOPPED;
}
wadj_prop_fini(&prop);
AZ(prop);
}
}
/*-
* Copyright 2017 UPLEX Nils Goroll Systemoptimierung
*
* All rights reserved.
*
* Author: Nils Goroll <nils.goroll@uplex.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
enum run_state_e {
STOPPED = 0,
STOPPING,
STARTING,
RUNNING
};
struct wadj_prop {
unsigned magic;
#define WADJ_PROP_MAGIC 0xa05991ff
VTAILQ_ENTRY(wadj_prop) list_vd;
VTAILQ_ENTRY(wadj_prop) list_vcl;
struct vdir *vd;
struct backend *be;
int *vd_updates;
pthread_t thread;
enum run_state_e run;
vre_t *vre;
char *req;
int reqlen;
VCL_DURATION timeout;
VCL_DURATION interval;
VCL_INT bufsz;
};
struct vmod_wadj_vcl {
unsigned magic;
#define VMOD_WADJ_VCL_MAGIC 0xc125c9c3
struct wadj_prop_head props;
pthread_mutex_t mtx;
enum vcl_event_e state;
};
enum wadj_thr_action_e {
STOP,
START,
DEFAULT
};
void wadj_thr_ctl(struct vmod_wadj_vcl *wa_vcl,
struct wadj_prop *prop, enum wadj_thr_action_e action);
void wadj_dir_fini(const struct wadj_prop_head *vd_props,
struct wadj_prop_head *vcl_props);
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