neels has uploaded this change for review.

View Change

change back dispatch ordering in map_rua_init_action()

Before patch I3e1ad7a2aa71674a22a27c31512600f2de139032,
the order was:

case MAP_RUA_EV_RX_CONNECT:
state-chg --> map_rua_fsm_state_chg(MAP_RUA_ST_CONNECTED);
dispatch --> map_sccp_dispatch(map, MAP_SCCP_EV_TX_DATA_REQUEST, ranap_msg);
return;

From that patch on, the order is:

case MAP_RUA_EV_RX_CONNECT:
dispatch --> handle_rx_rua(fi, ranap_msg);
state-chg --> map_rua_fsm_state_chg(MAP_RUA_ST_CONNECTED);
return;

The ordering of event dispatching and state changing is a delicate matter,
because event dispatching might result in an fsm deallocation, especially on
corner case errors. Attempting to modify the state after that may crash.

TODO: insert actual proven reason for this patch here.

TODO: explain why the same ordering one 'case' below is not a problem.

Change-Id: Ie277c46d153bc12dc28a914c241392cdf5ec0aa4
---
M src/osmo-hnbgw/context_map_rua.c
1 file changed, 33 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/88/36888/1
diff --git a/src/osmo-hnbgw/context_map_rua.c b/src/osmo-hnbgw/context_map_rua.c
index 3c6ea1e..67d50d0 100644
--- a/src/osmo-hnbgw/context_map_rua.c
+++ b/src/osmo-hnbgw/context_map_rua.c
@@ -219,9 +219,9 @@
switch (event) {

case MAP_RUA_EV_RX_CONNECT:
+ map_rua_fsm_state_chg(MAP_RUA_ST_CONNECTED);
/* not needed for RAB assignment scanning, but for KPI scanning */
handle_rx_rua(fi, ranap_msg);
- map_rua_fsm_state_chg(MAP_RUA_ST_CONNECTED);
return;

case MAP_RUA_EV_RX_DISCONNECT:

To view, visit change 36888. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ie277c46d153bc12dc28a914c241392cdf5ec0aa4
Gerrit-Change-Number: 36888
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
Gerrit-MessageType: newchange