From 6c4fabc82675c45361c12fc3d140d85d4a8df1e4 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 5 Nov 2019 19:11:16 +0100 Subject: xua: loadshare: select ASP for tx only if active Change-Id: I4f1d1aa9395698e5b6b930a5092a4b914dd15fb3 --- include/osmocom/sigtran/osmo_ss7.h | 1 + src/osmo_ss7.c | 7 +++++++ src/xua_as_fsm.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 826b890..d0aa9a1 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -442,6 +442,7 @@ void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp); int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg); int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp); int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level); +bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp); /*! Weak function to handle payload for unknown/unsupported PPID or IPA StreamID. * This function can be overridden by application code to implement whatever handling diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 8c547e8..fa6a338 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1352,6 +1352,13 @@ int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp) return 0; } +bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp) +{ + if (!asp->fi) + return false; + return asp->fi->state == XUA_ASP_S_ACTIVE; +} + /*********************************************************************** * libosmo-netif integration for SCTP stream server/client ***********************************************************************/ diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c index ab98da8..b0fbd2a 100644 --- a/src/xua_as_fsm.c +++ b/src/xua_as_fsm.c @@ -101,7 +101,7 @@ static struct osmo_ss7_asp *xua_as_select_asp_roundrobin(struct osmo_ss7_as *as) i = first_idx; do { asp = as->cfg.asps[i]; - if (asp) + if (asp && osmo_ss7_asp_active(asp)) break; i = (i + 1) % ARRAY_SIZE(as->cfg.asps); } while (i != first_idx); -- cgit v1.2.3