[MINOR] add a weight divisor to the struct proxy
Under some circumstances, it will be useful to be able to have
a server's effective weight bigger than the user weight, and this
is particularly true for dynamic weight-based algorithms. In order
to support this, we add a "wdiv" member to the lbprm structure
which will always be used to divide the weights before reporting
them.
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 2c91b43..cac57cf 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -756,7 +756,7 @@
/* act, bck */
"<td>%s</td><td>%s</td>"
"",
- sv->uweight,
+ sv->eweight * px->lbprm.wmult / px->lbprm.wdiv,
(sv->state & SRV_BACKUP) ? "-" : "Y",
(sv->state & SRV_BACKUP) ? "Y" : "-");
@@ -808,7 +808,7 @@
/* weight, active, backup */
"%d,%d,%d,"
"",
- sv->uweight,
+ sv->eweight * px->lbprm.wmult / px->lbprm.wdiv,
(sv->state & SRV_BACKUP) ? 0 : 1,
(sv->state & SRV_BACKUP) ? 1 : 0);
@@ -872,7 +872,7 @@
px->retries, px->redispatches,
human_time(now.tv_sec - px->last_change, 1),
(px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN",
- px->lbprm.tot_weight * px->lbprm.wmult,
+ px->lbprm.tot_weight * px->lbprm.wmult / px->lbprm.wdiv,
px->srv_act, px->srv_bck);
chunk_printf(&msg, sizeof(trash),
@@ -918,7 +918,7 @@
px->failed_conns, px->failed_resp,
px->retries, px->redispatches,
(px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN",
- px->lbprm.tot_weight * px->lbprm.wmult,
+ px->lbprm.tot_weight * px->lbprm.wmult / px->lbprm.wdiv,
px->srv_act, px->srv_bck,
px->down_trans, now.tv_sec - px->last_change,
px->srv?be_downtime(px):0,