Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/10637


Change subject: cosmetic: lchan_fsm failure: log about state transitions
......................................................................

cosmetic: lchan_fsm failure: log about state transitions

Early on during failure, log which state transition is intended after failure
handling.

If such state is already reached after failure handling, do not log "state
transition not permitted", but rather skip the state change and log "Already in
state X".

Change-Id: I81f53b38637823e62860cb773b7573bb5c21fdb0
---
M src/osmo-bsc/lchan_fsm.c
1 file changed, 9 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/37/10637/1

diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index e0015cb..e856fd0 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -213,16 +213,23 @@
  * continue with (using state timeouts from lchan_fsm_timeouts[]). Assumes 
local variable fi exists. */
 #define lchan_fail_to(STATE_CHG, fmt, args...) do { \
                struct gsm_lchan *_lchan = fi->priv; \
+               struct osmo_fsm *fsm = fi->fsm; \
                uint32_t state_was = fi->state; \
                /* Snapshot the target state, in case the macro argument 
evaluates differently later */ \
                const uint32_t state_chg = STATE_CHG; \
+               LOG_LCHAN(_lchan, LOGL_DEBUG, "Handling failure, will then 
transition to state %s\n", \
+                         osmo_fsm_state_name(fsm, state_chg)); \
                lchan_set_last_error(_lchan, "lchan %s in state %s: " fmt, \
                                     _lchan->activate.concluded ? "failure" : 
"allocation failed", \
-                                    osmo_fsm_state_name(fi->fsm, state_was), 
## args); \
+                                    osmo_fsm_state_name(fsm, state_was), ## 
args); \
                if (!_lchan->activate.concluded) \
                        lchan_on_activation_failure(_lchan, 
_lchan->activate.activ_for, _lchan->conn); \
                _lchan->activate.concluded = true; \
-               lchan_fsm_state_chg(state_chg); \
+               if (fi->state != state_chg) \
+                       lchan_fsm_state_chg(state_chg); \
+               else \
+                       LOG_LCHAN(_lchan, LOGL_DEBUG, "After failure handling, 
already in state %s\n", \
+                                 osmo_fsm_state_name(fsm, state_chg)); \
        } while(0)

 /* Which state to transition to when lchan_fail() is called in a given state. 
*/

--
To view, visit https://gerrit.osmocom.org/10637
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I81f53b38637823e62860cb773b7573bb5c21fdb0
Gerrit-Change-Number: 10637
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to