Commit ce30412a authored by Nils Goroll's avatar Nils Goroll

whitespace cleanup

parent 5e913b62
/*-
* Copyright 2009-2015 UPLEX - Nils Goroll Systemoptimierung
* Copyright 2009-2016 UPLEX - Nils Goroll Systemoptimierung
* All rights reserved.
*
* Authors: Nils Goroll <nils.goroll@uplex.de>
......@@ -73,7 +73,8 @@ vslp_get_prefered_idx(const struct vslpdir *vslpd, const uint32_t key)
idx = i;
else if (i == n - 1)
idx = n - 1;
else if (vslpd->hashcircle[i].point < key && vslpd->hashcircle[i+1].point >= key)
else if (vslpd->hashcircle[i].point < key &&
vslpd->hashcircle[i+1].point >= key)
idx = i + 1;
else if (vslpd->hashcircle[i].point > key)
if (i == 0)
......@@ -102,7 +103,8 @@ vslp_be_healthy(struct vslp_state *state, int chosen)
now = time(NULL);
if(state->vslpd->bstate[chosen].recover_time == 0)
state->vslpd->bstate[chosen].recover_time = now;
if (now >= (state->vslpd->bstate[chosen].recover_time + state->vslpd->rampup_time))
if (now >= (state->vslpd->bstate[chosen].recover_time +
state->vslpd->rampup_time))
{
state->vslpd->bstate[chosen].state = 1;
state->vslpd->bstate[chosen].recover_time = 0;
......@@ -148,10 +150,11 @@ vslp_choose_next(struct vslp_state *state, uint32_t n_retry)
if(i >= (state->vslpd->n_backend * state->vslpd->replicas))
i = i - (state->vslpd->n_backend * state->vslpd->replicas);
chosen = state->vslpd->hashcircle[i].host;
n_retry++;
if(n_retry > (state->vslpd->n_backend * state->vslpd->replicas) + state->vslpd->n_backend)
if(n_retry >
state->vslpd->n_backend * state->vslpd->replicas +
state->vslpd->n_backend)
return -1;
} while (state->picklist & (1 << chosen));
state->picklist |= 1 << chosen;
......@@ -300,7 +303,6 @@ vslpdir_init_hashcircle(struct vslpdir *vslpd, VCL_INT replicas)
}
vslpd->replicas = replicas;
for (i = 0; i < vslpd->n_backend; i++) {
for (j = 0; j < replicas; j++) {
int len = strlen(vslpd->backend[i]->vcl_name)
......@@ -312,7 +314,8 @@ vslpdir_init_hashcircle(struct vslpdir *vslpd, VCL_INT replicas)
vslp_hash_sha256(s);
vslpd->hashcircle[i * replicas + j].host = i;
}
vslpd->bstate[i].canon_point = vslpd->hashcircle[i * replicas].point;
vslpd->bstate[i].canon_point =
vslpd->hashcircle[i * replicas].point;
}
qsort( (void *) vslpd->hashcircle, vslpd->n_backend * replicas,
sizeof (struct vslp_hostnode), (compar) hostnode_compare);
......@@ -321,7 +324,9 @@ vslpdir_init_hashcircle(struct vslpdir *vslpd, VCL_INT replicas)
{
for (j = 0; j < replicas; j++)
{
VSL(SLT_Debug, 0, "VSLP hashcircle[%5ld] = {point = %8x, host = %2d}\n",
VSL(SLT_Debug, 0,
"VSLP hashcircle[%5ld] = "
"{point = %8x, host = %2d}\n",
i * replicas + j,
vslpd->hashcircle[i * replicas + j].point,
vslpd->hashcircle[i * replicas + j].host);
......@@ -378,7 +383,8 @@ vslpdir_any_healthy(struct vslpdir *vslpd)
return (retval);
}
VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd, const struct vrt_ctx *ctx, uint32_t hash,
VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd,
const struct vrt_ctx *ctx, uint32_t hash,
VCL_INT n_retry, VCL_BOOL altsrv_p, VCL_BOOL healthy)
{
VCL_BACKEND be;
......@@ -435,11 +441,13 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd, const struct vrt_ctx *ctx, ui
if(chosen < 0) {
VSLb(ctx->vsl, SLT_Debug,
"VSLP failed to find other healthy backend for key %8x in restarts: %2i/%2i - using previous",
"VSLP failed to find other healthy backend "
"for key %8x in restarts: %2i/%2i - using previous",
hash, restarts, restarts_o);
} else {
VSLb(ctx->vsl, SLT_Debug,
"VSLP picked backend %2i for key %8x in restarts: %2i/%2i",
"VSLP picked backend %2i "
"for key %8x in restarts: %2i/%2i",
chosen, hash, restarts, restarts_o);
be = vslpd->backend[chosen];
AN(be);
......@@ -469,10 +477,12 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd, const struct vrt_ctx *ctx, ui
chosen = vslp_choose_next_healthy(&state, n_retry);
if(chosen < 0) {
VSLb(ctx->vsl, SLT_Debug,
"VSLP found no alternative backend in healthy");
"VSLP found no alternative backend "
"in healthy");
} else {
VSLb(ctx->vsl, SLT_Debug,
"VSLP picked alternative backend %2i for key %8x in healthy",
"VSLP picked alternative backend %2i "
"for key %8x in healthy",
chosen, hash);
be = vslpd->backend[chosen];
}
......@@ -487,7 +497,8 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd, const struct vrt_ctx *ctx, ui
"VSLP found no alternative backend in unhealthy");
} else {
VSLb(ctx->vsl, SLT_Debug,
"VSLP picked alternative backend %2i for key %8x in unhealthy",
"VSLP picked alternative backend %2i "
"for key %8x in unhealthy",
chosen, hash);
be = vslpd->backend[chosen];
}
......
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