<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10637">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cosmetic: lchan_fsm failure: log about state transitions<br><br>Early on during failure, log which state transition is intended after failure<br>handling.<br><br>If such state is already reached after failure handling, do not log "state<br>transition not permitted", but rather skip the state change and log "Already in<br>state X".<br><br>Change-Id: I81f53b38637823e62860cb773b7573bb5c21fdb0<br>---<br>M src/osmo-bsc/lchan_fsm.c<br>1 file changed, 9 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/37/10637/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c</span><br><span>index e0015cb..e856fd0 100644</span><br><span>--- a/src/osmo-bsc/lchan_fsm.c</span><br><span>+++ b/src/osmo-bsc/lchan_fsm.c</span><br><span>@@ -213,16 +213,23 @@</span><br><span>  * continue with (using state timeouts from lchan_fsm_timeouts[]). Assumes local variable fi exists. */</span><br><span> #define lchan_fail_to(STATE_CHG, fmt, args...) do { \</span><br><span>            struct gsm_lchan *_lchan = fi->priv; \</span><br><span style="color: hsl(120, 100%, 40%);">+             struct osmo_fsm *fsm = fi->fsm; \</span><br><span>                 uint32_t state_was = fi->state; \</span><br><span>                 /* Snapshot the target state, in case the macro argument evaluates differently later */ \</span><br><span>            const uint32_t state_chg = STATE_CHG; \</span><br><span style="color: hsl(120, 100%, 40%);">+               LOG_LCHAN(_lchan, LOGL_DEBUG, "Handling failure, will then transition to state %s\n", \</span><br><span style="color: hsl(120, 100%, 40%);">+                       osmo_fsm_state_name(fsm, state_chg)); \</span><br><span>            lchan_set_last_error(_lchan, "lchan %s in state %s: " fmt, \</span><br><span>                                    _lchan->activate.concluded ? "failure" : "allocation failed", \</span><br><span style="color: hsl(0, 100%, 40%);">-                                  osmo_fsm_state_name(fi->fsm, state_was), ## args); \</span><br><span style="color: hsl(120, 100%, 40%);">+                               osmo_fsm_state_name(fsm, state_was), ## args); \</span><br><span>                if (!_lchan->activate.concluded) \</span><br><span>                        lchan_on_activation_failure(_lchan, _lchan->activate.activ_for, _lchan->conn); \</span><br><span>               _lchan->activate.concluded = true; \</span><br><span style="color: hsl(0, 100%, 40%);">-         lchan_fsm_state_chg(state_chg); \</span><br><span style="color: hsl(120, 100%, 40%);">+             if (fi->state != state_chg) \</span><br><span style="color: hsl(120, 100%, 40%);">+                      lchan_fsm_state_chg(state_chg); \</span><br><span style="color: hsl(120, 100%, 40%);">+             else \</span><br><span style="color: hsl(120, 100%, 40%);">+                        LOG_LCHAN(_lchan, LOGL_DEBUG, "After failure handling, already in state %s\n", \</span><br><span style="color: hsl(120, 100%, 40%);">+                              osmo_fsm_state_name(fsm, state_chg)); \</span><br><span>    } while(0)</span><br><span> </span><br><span> /* Which state to transition to when lchan_fail() is called in a given state. */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10637">change 10637</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10637"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I81f53b38637823e62860cb773b7573bb5c21fdb0 </div>
<div style="display:none"> Gerrit-Change-Number: 10637 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>