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
This commit is contained in:
Neels Hofmeyr 2018-08-27 22:03:35 +02:00
parent 3ea8baeab0
commit e23e1aeec2
1 changed files with 9 additions and 2 deletions

View File

@ -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. */