[MERGED] libosmo-sccp[master]: osmo_ss7: Send M-SCTP_RELEASE.ind for close of xUA client or...

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
Tue Apr 11 22:27:02 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7: Send M-SCTP_RELEASE.ind for close of xUA client or server socket
......................................................................


osmo_ss7: Send M-SCTP_RELEASE.ind for close of xUA client or server socket

Change-Id: I31e7de136545279a75a5faca0927d3dbf11ff46d
---
M src/osmo_ss7.c
1 file changed, 22 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index aa331b9..b916094 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1252,6 +1252,22 @@
 	return 0;
 }
 
+static void xua_cli_close(struct osmo_stream_cli *cli)
+{
+	struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(cli);
+
+	osmo_stream_cli_close(cli);
+
+	/* send M-SCTP_RELEASE.ind to XUA Layer Manager */
+	xua_asp_send_xlm_prim_simple(asp, OSMO_XLM_PRIM_M_SCTP_RELEASE, PRIM_OP_INDICATION);
+}
+
+static void xua_cli_close_and_reconnect(struct osmo_stream_cli *cli)
+{
+	xua_cli_close(cli);
+	osmo_stream_cli_reconnect(cli);
+}
+
 static int xua_cli_read_cb(struct osmo_stream_cli *conn)
 {
 	struct osmo_fd *ofd = osmo_stream_cli_get_ofd(conn);
@@ -1271,10 +1287,10 @@
 	LOGPASP(asp, DLSS7, LOGL_DEBUG, "%s(): sctp_recvmsg() returned %d (flags=0x%x)\n",
 		__func__, rc, flags);
 	if (rc < 0) {
-		osmo_stream_cli_reconnect(conn);
+		xua_cli_close_and_reconnect(conn);
 		goto out;
 	} else if (rc == 0) {
-		osmo_stream_cli_reconnect(conn);
+		xua_cli_close_and_reconnect(conn);
 	} else {
 		msgb_put(msg, rc);
 	}
@@ -1287,7 +1303,7 @@
 		switch (notif->sn_header.sn_type) {
 		case SCTP_SHUTDOWN_EVENT:
 			osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_SCTP_COMM_DOWN_IND, asp);
-			osmo_stream_cli_reconnect(conn);
+			xua_cli_close_and_reconnect(conn);
 			break;
 		default:
 			break;
@@ -1328,6 +1344,9 @@
 
 	/* FIXME: somehow notify ASP FSM and everyone else */
 
+	/* send M-SCTP_RELEASE.ind to Layer Manager */
+	xua_asp_send_xlm_prim_simple(asp, OSMO_XLM_PRIM_M_SCTP_RELEASE, PRIM_OP_INDICATION);
+
 	return 0;
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I31e7de136545279a75a5faca0927d3dbf11ff46d
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