summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-11-05 19:11:16 +0100
committerlaforge <laforge@osmocom.org>2019-11-06 04:55:37 +0000
commit6c4fabc82675c45361c12fc3d140d85d4a8df1e4 (patch)
tree40b9210aaf87c6fac0dedde298bca93106c42a0b
parente924573490ae5b6c2c80bd6cb6c132fb038324c8 (diff)
xua: loadshare: select ASP for tx only if active
-rw-r--r--include/osmocom/sigtran/osmo_ss7.h1
-rw-r--r--src/osmo_ss7.c7
-rw-r--r--src/xua_as_fsm.c2
3 files changed, 9 insertions, 1 deletions
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);