aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-08-27 22:03:35 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-08-29 02:02:10 +0200
commite23e1aeec2206e56cb4bd3f0bffb39eef44c0e41 (patch)
tree39fc56e28bc36b9e4dc67cedbc26d6405b29775d /src
parent3ea8baeab00964217bd20027d6d61c625e62b5e4 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/lchan_fsm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index e0015cbeb..e856fd0fa 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -213,16 +213,23 @@ struct state_timeout lchan_fsm_timeouts[32] = {
* 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. */