[PATCH] libosmo-sccp[master]: osmo_ss7: Clean up all ASPs established via xua_server upon ...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Apr 15 21:14:17 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/2351

to look at the new patch set (#3).

osmo_ss7: Clean up all ASPs established via xua_server upon destroy

When we destroy a xua_server, we would like to close and destroy any
ASPs that were established via that xua_server.   In order to do so, we
need to add a list of ASPs to the xua_server, which we can iterate.

Change-Id: Iff3ed099b817e54e563b70d9ab40f63af63cc2fb
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
2 files changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/51/2351/3

diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 376e399..a8c1c3c 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -339,6 +339,7 @@
 
 	/*! \ref osmo_xua_server over which we were established */
 	struct osmo_xua_server *xua_server;
+	struct llist_head siblings;
 
 	/*! osmo_stream / libosmo-netif handles */
 	struct osmo_stream_cli *client;
@@ -396,6 +397,9 @@
 	struct llist_head list;
 	struct osmo_ss7_instance *inst;
 
+	/* list of ASPs established via this server */
+	struct llist_head asp_list;
+
 	struct osmo_stream_srv_link *server;
 
 	struct {
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 771501f..44f34fe 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1050,6 +1050,8 @@
 		osmo_stream_cli_destroy(asp->client);
 	if (asp->fi)
 		osmo_fsm_inst_term(asp->fi, OSMO_FSM_TERM_REQUEST, NULL);
+	if (asp->xua_server)
+		llist_del(&asp->siblings);
 
 	/* unlink from all ASs we are part of */
 	llist_for_each_entry(as, &asp->inst->as_list, list) {
@@ -1481,6 +1483,8 @@
 	/* update the ASP reference back to the server over which the
 	 * connection came in */
 	asp->server = srv;
+	asp->xua_server = oxs;
+	llist_add_tail(&asp->siblings, &oxs->asp_list);
 	/* update the ASP socket name */
 	if (asp->sock_name)
 		talloc_free(asp->sock_name);
@@ -1575,6 +1579,8 @@
 	LOGP(DLSS7, LOGL_INFO, "Creating XUA Server %s:%u\n",
 		local_host, local_port);
 
+	INIT_LLIST_HEAD(&oxs->asp_list);
+
 	oxs->cfg.proto = proto;
 	oxs->cfg.local.port = local_port;
 	oxs->cfg.local.host = talloc_strdup(oxs, local_host);
@@ -1614,13 +1620,17 @@
 
 void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs)
 {
+	struct osmo_ss7_asp *asp, *asp2;
+
 	if (xs->server) {
 		osmo_stream_srv_link_close(xs->server);
 		osmo_stream_srv_link_destroy(xs->server);
 	}
-	/* FIXME: add asp_list to xua_server so we can iterate it here
-	 * and close all connections established in relation with this
-	 * server */
+	/* iterate and close all connections established in relation
+	 * with this server */
+	llist_for_each_entry_safe(asp, asp2, &xs->asp_list, siblings)
+		osmo_ss7_asp_destroy(asp);
+
 	llist_del(&xs->list);
 	talloc_free(xs);
 }

-- 
To view, visit https://gerrit.osmocom.org/2351
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iff3ed099b817e54e563b70d9ab40f63af63cc2fb
Gerrit-PatchSet: 3
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list