mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 13:21:29 +02:00
MINOR: listener: add listener_index_id() to index a listener by its ID
This avoids needlessly exposing the tree's root and the mechanics outside of the low-level code.
This commit is contained in:
parent
5a5cec4d7a
commit
5e4b6714e1
@ -25,8 +25,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <import/eb32tree.h>
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/listener-t.h>
|
||||
#include <haproxy/proxy-t.h>
|
||||
|
||||
struct proxy;
|
||||
struct task;
|
||||
@ -236,6 +239,12 @@ enum li_status get_li_status(struct listener *l);
|
||||
/* number of times an accepted connection resulted in maxconn being reached */
|
||||
extern ullong maxconn_reached;
|
||||
|
||||
/* index listener <li>'s id into proxy <px>'s used_listener_id */
|
||||
static inline void listener_index_id(struct proxy *px, struct listener *li)
|
||||
{
|
||||
eb32_insert(&px->conf.used_listener_id, &li->conf.id);
|
||||
}
|
||||
|
||||
static inline uint accept_queue_ring_len(const struct accept_queue_ring *ring)
|
||||
{
|
||||
uint idx, head, tail, len;
|
||||
|
@ -4292,7 +4292,7 @@ init_proxies_list_stage2:
|
||||
}
|
||||
next_id = listener_get_next_id(curproxy, next_id);
|
||||
listener->conf.id.key = listener->luid = next_id;
|
||||
eb32_insert(&curproxy->conf.used_listener_id, &listener->conf.id);
|
||||
listener_index_id(curproxy, listener);
|
||||
}
|
||||
next_id++;
|
||||
|
||||
|
@ -1874,7 +1874,7 @@ int bind_complete_thread_setup(struct bind_conf *bind_conf, int *err_code)
|
||||
tmp_li->luid = 0;
|
||||
eb32_delete(&tmp_li->conf.id);
|
||||
if (new_li->luid)
|
||||
eb32_insert(&fe->conf.used_listener_id, &new_li->conf.id);
|
||||
listener_index_id(fe, new_li);
|
||||
new_li = tmp_li;
|
||||
}
|
||||
}
|
||||
@ -1898,7 +1898,7 @@ int bind_complete_thread_setup(struct bind_conf *bind_conf, int *err_code)
|
||||
li->luid = 0;
|
||||
eb32_delete(&li->conf.id);
|
||||
if (new_li->luid)
|
||||
eb32_insert(&fe->conf.used_listener_id, &new_li->conf.id);
|
||||
listener_index_id(fe, new_li);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2256,7 +2256,7 @@ static int bind_parse_id(char **args, int cur_arg, struct proxy *px, struct bind
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
|
||||
eb32_insert(&px->conf.used_listener_id, &new->conf.id);
|
||||
listener_index_id(px, new);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user