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 <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to