Change in osmo-bsc[master]: cosmetic: lchan_fsm failure: log about state transitions

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Aug 27 23:05:03 UTC 2018


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 <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180827/42b93252/attachment.htm>


More information about the gerrit-log mailing list