From 6d78c5308adf7f78cf5de2280b5b8c37fc886c00 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Mon, 12 Feb 2024 16:26:41 +0100 Subject: wip reconnect notify --- src/osmo_ss7_asp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c index 539258c..458e7c1 100644 --- a/src/osmo_ss7_asp.c +++ b/src/osmo_ss7_asp.c @@ -835,11 +835,10 @@ static int xua_cli_connect_cb(struct osmo_stream_cli *cli) return rc; } -static void xua_cli_close(struct osmo_stream_cli *cli) +static void xua_cli_sctp_down(struct osmo_stream_cli *cli) { struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(cli); - osmo_stream_cli_close(cli); osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_SCTP_COMM_DOWN_IND, asp); /* 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); @@ -847,7 +846,8 @@ static void xua_cli_close(struct osmo_stream_cli *cli) static void xua_cli_close_and_reconnect(struct osmo_stream_cli *cli) { - xua_cli_close(cli); + osmo_stream_cli_close(cli); + xua_cli_sctp_down(cli); osmo_stream_cli_reconnect(cli); } @@ -892,6 +892,13 @@ static int xua_cli_read_cb(struct osmo_stream_cli *conn, struct msgb *msg) goto out; } + /* If connection has been closed, the client will try to re-connect. + * Indicate towards state machine that the connection has been closed. */ + if (msg->len == 0) { + xua_cli_sctp_down(conn); + goto out; + } + ppid = msgb_sctp_ppid(msg); msg->dst = asp; rate_ctr_inc2(asp->ctrg, SS7_ASP_CTR_PKT_RX_TOTAL); -- cgit v1.2.3