mgcp-client: Rename internal field in mgcp_client_pool

Having a list named pool inside an object already named pool is quite
confusing. Let's rename the field so that it makes sense immediatelly
when looking at it.

Change-Id: I4062af6b619317c48223ad4577eaaad05d4eec9d
This commit is contained in:
Pau Espin 2022-10-13 16:37:12 +02:00
parent a6917fecb1
commit d4ad77d326
3 changed files with 13 additions and 13 deletions

View File

@ -33,7 +33,7 @@ struct mgcp_client_pool {
struct mgcp_client *mgcp_client_single;
/* A list that manages the pool members (see mgcp_client_pool_member->list above) */
struct llist_head pool;
struct llist_head member_list;
/* String to use for indentation when writing the configuration file to the VTY. This field is populated by
* mgcp_client_pool_vty_init() */

View File

@ -64,7 +64,7 @@ struct mgcp_client_pool *mgcp_client_pool_alloc(void *talloc_ctx)
if (!pool)
return NULL;
INIT_LLIST_HEAD(&pool->pool);
INIT_LLIST_HEAD(&pool->member_list);
return pool;
}
@ -77,7 +77,7 @@ unsigned int mgcp_client_pool_connect(struct mgcp_client_pool *pool)
struct mgcp_client_pool_member *pool_member;
unsigned int pool_members_initialized = 0;
llist_for_each_entry(pool_member, &pool->pool, list) {
llist_for_each_entry(pool_member, &pool->member_list, list) {
/* Initialize client */
pool_member->client = mgcp_client_init(pool_member, &pool_member->conf);
@ -126,7 +126,7 @@ static struct mgcp_client_pool_member *mgcp_client_pool_pick(struct mgcp_client_
struct mgcp_client_pool_member *pool_member_picked = NULL;
unsigned int n_pool_members = 0;
llist_for_each_entry(pool_member, &pool->pool, list) {
llist_for_each_entry(pool_member, &pool->member_list, list) {
n_pool_members++;
if (pool_member->blocked == false && pool_member->client) {
if (!pool_member_picked)
@ -164,14 +164,14 @@ struct mgcp_client *mgcp_client_pool_get(struct mgcp_client_pool *pool)
* by the application code. */
/* When the pool is empty, return a single MGCP client if it is registered. */
if (llist_empty(&pool->pool) && pool->mgcp_client_single) {
if (llist_empty(&pool->member_list) && pool->mgcp_client_single) {
LOGP(DLMGCP, LOGL_DEBUG, "MGW pool is empty -- using (single) MGW %s\n",
mgcp_client_name(pool->mgcp_client_single));
return pool->mgcp_client_single;
}
/* Abort when the pool is empty */
if (llist_empty(&pool->pool)) {
if (llist_empty(&pool->member_list)) {
LOGP(DLMGCP, LOGL_ERROR, "MGW pool is empty -- no MGW available!\n");
return NULL;
}
@ -205,7 +205,7 @@ void mgcp_client_pool_put(struct mgcp_client *mgcp_client)
else
return;
llist_for_each_entry(pool_member, &pool->pool, list) {
llist_for_each_entry(pool_member, &pool->member_list, list) {
if (pool_member->client == mgcp_client) {
if (pool_member->refcount == 0) {
LOGPPMGW(pool_member, LOGL_ERROR, "MGW pool member has invalid refcount\n");

View File

@ -328,7 +328,7 @@ static int config_write_pool(struct vty *vty)
snprintf(indent, indent_buf_len, "%s ", pool->vty_indent);
llist_for_each_entry(pool_member, &pool->pool, list) {
llist_for_each_entry(pool_member, &pool->member_list, list) {
vty_out(vty, "%smgw %u%s", pool->vty_indent, pool_member->nr, VTY_NEWLINE);
config_write(vty, indent, &pool_member->conf);
}
@ -343,7 +343,7 @@ static struct mgcp_client_pool_member *pool_member_by_nr(unsigned int nr)
struct mgcp_client_pool_member *pool_member = NULL;
struct mgcp_client_pool_member *pool_member_tmp;
llist_for_each_entry(pool_member_tmp, &global_mgcp_client_pool->pool, list) {
llist_for_each_entry(pool_member_tmp, &global_mgcp_client_pool->member_list, list) {
if (pool_member_tmp->nr == nr) {
pool_member = pool_member_tmp;
break;
@ -365,7 +365,7 @@ DEFUN_ATTR(cfg_mgw,
OSMO_ASSERT(pool_member);
mgcp_client_conf_init(&pool_member->conf);
pool_member->nr = nr;
llist_add_tail(&pool_member->list, &global_mgcp_client_pool->pool);
llist_add_tail(&pool_member->list, &global_mgcp_client_pool->member_list);
}
vty->index = &pool_member->conf;
@ -498,15 +498,15 @@ DEFUN(mgw_show, mgw_show_cmd, "show mgw-pool", SHOW_STR "Display information abo
vty_out(vty, "%% MGW-Pool:%s", VTY_NEWLINE);
struct mgcp_client_pool_member *pool_member;
if (llist_empty(&global_mgcp_client_pool->pool) && global_mgcp_client_pool->mgcp_client_single) {
if (llist_empty(&global_mgcp_client_pool->member_list) && global_mgcp_client_pool->mgcp_client_single) {
vty_out(vty, "%% (pool is empty, single MGCP client will be used)%s", VTY_NEWLINE);
return CMD_SUCCESS;
} else if (llist_empty(&global_mgcp_client_pool->pool)) {
} else if (llist_empty(&global_mgcp_client_pool->member_list)) {
vty_out(vty, "%% (pool is empty)%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
llist_for_each_entry(pool_member, &global_mgcp_client_pool->pool, list) {
llist_for_each_entry(pool_member, &global_mgcp_client_pool->member_list, list) {
vty_out(vty, "%% MGW %s%s", mgcp_client_pool_member_name(pool_member), VTY_NEWLINE);
vty_out(vty, "%% mgcp-client: %s%s", pool_member->client ? "connected" : "disconnected",
VTY_NEWLINE);