Skip to content
Permalink
Browse files

Move directors.hash::backend to STRANDS

  • Loading branch information...
Dridi committed Jul 3, 2019
1 parent 8790bec commit 189a598ebf1e78436a95678d7255c4d399458b26
Showing with 5 additions and 9 deletions.
  1. +4 −8 lib/libvmod_directors/hash.c
  2. +1 −1 lib/libvmod_directors/vmod.vcc
@@ -108,29 +108,25 @@ vmod_hash_remove_backend(VRT_CTX,
}

VCL_BACKEND v_matchproto_()
vmod_hash_backend(VRT_CTX, struct vmod_directors_hash *rr,
const char *arg, ...)
vmod_hash_backend(VRT_CTX, struct vmod_directors_hash *rr, VCL_STRANDS s)
{
struct VSHA256Context sha_ctx;
va_list ap;
const char *p;
unsigned char sha256[VSHA256_LEN];
VCL_BACKEND be;
double r;
int i;

CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_ORNULL(ctx->bo, BUSYOBJ_MAGIC);

CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_HASH_MAGIC);
VSHA256_Init(&sha_ctx);
va_start(ap, arg);
p = arg;
while (p != vrt_magic_string_end) {
for (i = 0; i < s->n; i++) {
p = s->p[i];
if (p != NULL && *p != '\0')
VSHA256_Update(&sha_ctx, p, strlen(p));
p = va_arg(ap, const char *);
}
va_end(ap);
VSHA256_Final(sha256, &sha_ctx);

r = vbe32dec(sha256);
@@ -217,7 +217,7 @@ Remove a backend from the director.
Example::
vdir.remove_backend(backend1);

$Method BACKEND .backend(STRING_LIST)
$Method BACKEND .backend(STRANDS)

Pick a backend from the backend director.

0 comments on commit 189a598

Please sign in to comment.
You can’t perform that action at this time.