pespin has uploaded this change for review.
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
---
M src/osmo-bsc/abis_nm.c
M src/osmo-bsc/abis_om2000.c
2 files changed, 8 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/39/28039/1
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index cdb1fa6..e92601a 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -230,8 +230,10 @@
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 @@
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 04c783b..1deab13 100644
--- a/src/osmo-bsc/abis_om2000.c
+++ b/src/osmo-bsc/abis_om2000.c
@@ -992,9 +992,10 @@
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)
To view, visit change 28039. To unsubscribe, or for help writing mail filters, visit settings.