mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-28 04:10:50 -05:00
MINOR: proxy: improve code when checking server name conflicts
During proxy_finalize(), a lookup is performed over the servers by name tree to detect any collision. Only the first conflict for each server instance is reported to avoid a combinatory explosion with too many alerts shown. Previously, this was written using a for loop without any iteration. Replace this by a simple if statement as this is cleaner. This should fix github issue #3276.
This commit is contained in:
parent
c528824094
commit
05d73aa81c
1 changed files with 2 additions and 3 deletions
|
|
@ -2481,14 +2481,13 @@ int proxy_finalize(struct proxy *px, int *err_code)
|
|||
if (!ceb_intree(&newsrv->conf.name_node))
|
||||
continue;
|
||||
|
||||
for (other_srv = newsrv;
|
||||
(other_srv = cebis_item_prev_dup(&px->conf.used_server_name, conf.name_node, id, other_srv)); ) {
|
||||
if ((other_srv = cebis_item_prev_dup(&px->conf.used_server_name, conf.name_node, id, newsrv))) {
|
||||
ha_alert("parsing [%s:%d] : %s '%s', another server named '%s' was already defined at line %d, please use distinct names.\n",
|
||||
newsrv->conf.file, newsrv->conf.line,
|
||||
proxy_type_str(px), px->id,
|
||||
newsrv->id, other_srv->conf.line);
|
||||
cfgerr++;
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue