mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-17 19:16:56 +00:00
Revert "added the 'weight' parameter to the servers, limited to 1..256."
This reverts 3b002c7a7911ce5d658b29e6863ccf881b24c702 commit.
This commit is contained in:
parent
6433c2bb5a
commit
393cfb7b50
38
haproxy.c
38
haproxy.c
@ -513,8 +513,6 @@ struct server {
|
|||||||
int curfd; /* file desc used for current test, or -1 if not in test */
|
int curfd; /* file desc used for current test, or -1 if not in test */
|
||||||
int cur_sess; /* number of currently active sessions (including syn_sent) */
|
int cur_sess; /* number of currently active sessions (including syn_sent) */
|
||||||
unsigned int cum_sess; /* cumulated number of sessions really sent to this server */
|
unsigned int cum_sess; /* cumulated number of sessions really sent to this server */
|
||||||
unsigned char uweight, eweight; /* user-specified weight-1, and effective weight-1 */
|
|
||||||
unsigned short wsquare; /* eweight*eweight, to speed up map computation */
|
|
||||||
struct proxy *proxy; /* the proxy this server belongs to */
|
struct proxy *proxy; /* the proxy this server belongs to */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -7092,17 +7090,6 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
newsrv->state |= SRV_BACKUP;
|
newsrv->state |= SRV_BACKUP;
|
||||||
cur_arg ++;
|
cur_arg ++;
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[cur_arg], "weight")) {
|
|
||||||
int w;
|
|
||||||
w = atol(args[cur_arg + 1]);
|
|
||||||
if (w < 1 || w > 256) {
|
|
||||||
Alert("parsing [%s:%d] : weight of server %s is not within 1 and 256 (%d).\n",
|
|
||||||
file, linenum, newsrv->id, w);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
newsrv->uweight = w - 1;
|
|
||||||
cur_arg += 2;
|
|
||||||
}
|
|
||||||
else if (!strcmp(args[cur_arg], "check")) {
|
else if (!strcmp(args[cur_arg], "check")) {
|
||||||
global.maxsock++;
|
global.maxsock++;
|
||||||
do_check = 1;
|
do_check = 1;
|
||||||
@ -7119,7 +7106,7 @@ int cfg_parse_listen(char *file, int linenum, char **args) {
|
|||||||
cur_arg += 2;
|
cur_arg += 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'check', 'inter', 'rise', 'fall', 'port', 'source', and 'weight'.\n",
|
Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'check', 'inter', 'rise', 'fall', 'port' and 'source'.\n",
|
||||||
file, linenum, newsrv->id);
|
file, linenum, newsrv->id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -7901,26 +7888,9 @@ int readcfgfile(char *file) {
|
|||||||
cfgerr++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct server *srv;
|
while (newsrv != NULL) {
|
||||||
int pgcd;
|
/* nothing to check for now */
|
||||||
|
newsrv = newsrv->next;
|
||||||
if (newsrv) {
|
|
||||||
/* We will factor the weights to reduce the table,
|
|
||||||
* using Euclide's largest common divisor algorithm
|
|
||||||
*/
|
|
||||||
pgcd = newsrv->uweight + 1;
|
|
||||||
for (srv = newsrv->next; srv && pgcd > 1; srv = srv->next) {
|
|
||||||
int t, w;
|
|
||||||
|
|
||||||
w = srv->uweight + 1;
|
|
||||||
while (w) {
|
|
||||||
t = pgcd % w;
|
|
||||||
pgcd = w;
|
|
||||||
w = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (srv = newsrv; srv; srv = srv->next)
|
|
||||||
srv->eweight = ((srv->uweight + 1) / pgcd) - 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user