diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-05-04 16:23:24 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2022-05-13 09:58:58 +0000 |
commit | b7ef6884f91db7ffe7add51766abc311c9e7d05e (patch) | |
tree | 66c2caefbd763a08403353f751ac46e7fba7b357 /src | |
parent | f8c8b0d9c599ba070a7abf2698950495200fc467 (diff) |
Update current NM object state before signalling S_NM_STATECHG
This way code triggered through signal has an updated view of the object
tree when running generic code which queries the current state of
objects.
This way for instance one can use APIs like trx_is_usable() or alike.
Change-Id: Ib46234e3f3e446e866d27b0dfee65edf4af4d2ba
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bsc/abis_nm.c | 8 | ||||
-rw-r--r-- | src/osmo-bsc/abis_om2000.c | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c index a460f3e3b..8eeba8912 100644 --- a/src/osmo-bsc/abis_nm.c +++ b/src/osmo-bsc/abis_nm.c @@ -230,8 +230,10 @@ static int update_admstate(struct gsm_bts *bts, uint8_t obj_class, nsd.new_state.administrative = adm_state; - osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd); + /* Update current state before emitting signal: */ nm_state->administrative = adm_state; + + osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd); return 0; } @@ -296,10 +298,10 @@ static int abis_nm_rx_statechg_rep(struct msgb *mb) nsd.new_state.operational != nsd.old_state.operational || nsd.new_state.availability != nsd.old_state.availability) { DEBUGPC(DNM, "\n"); - /* Update the operational state of a given object in our in-memory data + /* Update the state of a given object in our in-memory data * structures and send an event to the higher layer */ - osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd); *nm_state = nsd.new_state; + osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd); } else { DEBUGPC(DNM, "(No State change detected)\n"); } diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c index 04c783b4c..1deab1364 100644 --- a/src/osmo-bsc/abis_om2000.c +++ b/src/osmo-bsc/abis_om2000.c @@ -992,9 +992,10 @@ static void update_mo_state(struct gsm_bts *bts, struct abis_om2k_mo *mo, uint8_ break; } - osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd); - + /* Update current state before emitting signal: */ nm_state->availability = nsd.new_state.availability; + + osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd); } static void update_op_state(struct gsm_bts *bts, const struct abis_om2k_mo *mo, uint8_t op_state) |