pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41498?usp=email )
Change subject: xua_rkm: Avoid unnecesary ASP lookup by name ......................................................................
xua_rkm: Avoid unnecesary ASP lookup by name
Change-Id: I5ca8f0180a0389d5de7b495cfe9f769985296383 --- M src/ss7_as.c M src/ss7_as.h M src/xua_rkm.c 3 files changed, 20 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/98/41498/1
diff --git a/src/ss7_as.c b/src/ss7_as.c index c2dee9d..e580dd3 100644 --- a/src/ss7_as.c +++ b/src/ss7_as.c @@ -194,16 +194,10 @@ * \param[in] as Application Server from which \ref asp is deleted * \param[in] asp Application Server Process to delete from \ref as * \returns 0 on success; negative in case of error */ -int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name) +int ss7_as_del_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp) { - struct osmo_ss7_asp *asp; unsigned int i;
- OSMO_ASSERT(ss7_initialized); - asp = osmo_ss7_asp_find_by_name(as->inst, asp_name); - if (!asp) - return -ENODEV; - LOGPAS(as, DLSS7, LOGL_INFO, "Removing ASP %s from AS\n", asp->cfg.name);
/* Remove route from AS-eSLS table: */ @@ -224,6 +218,23 @@ return -EINVAL; }
+/*! \brief Delete given ASP from given AS + * \param[in] as Application Server from which \ref asp is deleted + * \param[in] asp Name of the Application Server Process to delete from \ref as + * \returns 0 on success; negative in case of error */ +int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name) +{ + struct osmo_ss7_asp *asp; + unsigned int i; + + OSMO_ASSERT(ss7_initialized); + asp = osmo_ss7_asp_find_by_name(as->inst, asp_name); + if (!asp) + return -ENODEV; + + return ss7_as_del_asp(as, asp); +} + /*! \brief Destroy given Application Server * \param[in] as Application Server to destroy */ void osmo_ss7_as_destroy(struct osmo_ss7_as *as) diff --git a/src/ss7_as.h b/src/ss7_as.h index 4f5db78..bb7b1b2 100644 --- a/src/ss7_as.h +++ b/src/ss7_as.h @@ -137,6 +137,7 @@
unsigned int osmo_ss7_as_count_asp(const struct osmo_ss7_as *as); int ss7_as_add_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp); +int ss7_as_del_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp); int ss7_as_get_local_role(const struct osmo_ss7_as *as); void ss7_as_loadshare_binding_table_reset(struct osmo_ss7_as *as);
diff --git a/src/xua_rkm.c b/src/xua_rkm.c index 8817f49..7c98a3f 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -423,7 +423,7 @@ rctx, osmo_ss7_pointcode_print(inst, as->cfg.routing_key.pc));
/* remove ASP from AS */ - osmo_ss7_as_del_asp(as, asp->cfg.name); + osmo_ss7_as_del_asp(as, asp); /* FIXME: Rather than spoofing teh ASP-DOWN.ind to the AS here, * we should refuse RKM DEREG if the ASP is still ACTIVE */ osmo_fsm_inst_dispatch(as->fi, XUA_ASPAS_ASP_DOWN_IND, asp);