get rid of global osmo_ss7_xua_servers variable
By moving this variable into the SS7 instance, we avoid one more global variable, and we also fix a bug where the xua servers would be saved multiple times (once per instance). Change-Id: Icbab59d773f23cc8514cbeb6e21e25ca35dd337f
This commit is contained in:
parent
d95958b5fb
commit
05ad104c58
|
@ -10,7 +10,6 @@
|
|||
#include <osmocom/core/prim.h>
|
||||
|
||||
extern struct llist_head osmo_ss7_instances;
|
||||
extern struct llist_head osmo_ss7_xua_servers;
|
||||
|
||||
struct osmo_ss7_instance;
|
||||
struct osmo_ss7_user;
|
||||
|
@ -70,6 +69,8 @@ struct osmo_ss7_instance {
|
|||
struct llist_head asp_list;
|
||||
/*! list of \ref osmo_ss7_route_table */
|
||||
struct llist_head rtable_list;
|
||||
/*! list of \ref osmo_xua_servers */
|
||||
struct llist_head xua_servers;
|
||||
/* array for faster lookup of user (indexed by service
|
||||
* indicator) */
|
||||
const struct osmo_ss7_user *user[16];
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
static bool ss7_initialized = false;
|
||||
|
||||
LLIST_HEAD(osmo_ss7_instances);
|
||||
LLIST_HEAD(osmo_ss7_xua_servers);
|
||||
static int32_t next_rctx = 1;
|
||||
static int32_t next_l_rk_id = 1;
|
||||
|
||||
|
@ -329,6 +328,7 @@ osmo_ss7_instance_find_or_create(void *ctx, uint32_t id)
|
|||
INIT_LLIST_HEAD(&inst->as_list);
|
||||
INIT_LLIST_HEAD(&inst->asp_list);
|
||||
INIT_LLIST_HEAD(&inst->rtable_list);
|
||||
INIT_LLIST_HEAD(&inst->xua_servers);
|
||||
inst->rtable_system = osmo_ss7_route_table_find_or_create(inst, "system");
|
||||
|
||||
/* default point code structure + formatting */
|
||||
|
@ -1546,7 +1546,7 @@ osmo_ss7_xua_server_find(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_proto
|
|||
struct osmo_xua_server *xs;
|
||||
|
||||
OSMO_ASSERT(ss7_initialized);
|
||||
llist_for_each_entry(xs, &osmo_ss7_xua_servers, list) {
|
||||
llist_for_each_entry(xs, &inst->xua_servers, list) {
|
||||
if (proto == xs->cfg.proto &&
|
||||
local_port == xs->cfg.local.port)
|
||||
return xs;
|
||||
|
@ -1596,7 +1596,7 @@ osmo_ss7_xua_server_create(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_pro
|
|||
}
|
||||
|
||||
oxs->inst = inst;
|
||||
llist_add_tail(&oxs->list, &osmo_ss7_xua_servers);
|
||||
llist_add_tail(&oxs->list, &inst->xua_servers);
|
||||
|
||||
return oxs;
|
||||
}
|
||||
|
|
|
@ -915,7 +915,7 @@ static void write_one_cs7(struct vty *vty, struct osmo_ss7_instance *inst)
|
|||
llist_for_each_entry(rtable, &inst->rtable_list, list)
|
||||
write_one_rtable(vty, rtable);
|
||||
|
||||
llist_for_each_entry(oxs, &osmo_ss7_xua_servers, list)
|
||||
llist_for_each_entry(oxs, &inst->xua_servers, list)
|
||||
write_one_xua(vty, oxs);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue