Change in osmo-bsc[master]: lchan_fsm: add in_release_handler flag

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 Jul 23 01:00:26 UTC 2018


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


Change subject: lchan_fsm: add in_release_handler flag
......................................................................

lchan_fsm: add in_release_handler flag

Change-Id: Iec41e006b6ab9d0f618d36925341f9536353e5d8
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/lchan_fsm.c
2 files changed, 21 insertions(+), 7 deletions(-)



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

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 7bd0943..425de0b 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -525,6 +525,10 @@
 	/* RSL error code, RSL_ERR_* */
 	uint8_t rsl_error_cause;
 
+	/* If a release event is being handled, ignore other ricocheting release events until that
+	 * release handling has concluded. */
+	bool in_release_handler;
+
 	/* The logical channel type */
 	enum gsm_chan_t type;
 	/* RSL channel mode */
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 58adb99..6d090f6 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -521,7 +521,7 @@
 
 	case LCHAN_EV_RTP_RELEASED:
 	case LCHAN_EV_RTP_ERROR:
-		if (lchan->release_requested) {
+		if (lchan->in_release_handler) {
 			/* Already in release, the RTP is not the initial cause of failure.
 			 * Just ignore. */
 			return;
@@ -581,6 +581,7 @@
 		break;
 
 	case LCHAN_EV_RSL_CHAN_ACTIV_NACK:
+		lchan->in_release_handler = true;
 		if (data) {
 			uint32_t next_state;
 			lchan->rsl_error_cause = *(uint8_t*)data;
@@ -599,11 +600,12 @@
 			lchan->release_in_error = true;
 			lchan_fail_to(LCHAN_ST_BORKEN, "Chan Activ NACK without cause IE");
 		}
+		lchan->in_release_handler = false;
 		break;
 
 	case LCHAN_EV_RTP_RELEASED:
 	case LCHAN_EV_RTP_ERROR:
-		if (lchan->release_requested) {
+		if (lchan->in_release_handler) {
 			/* Already in release, the RTP is not the initial cause of failure.
 			 * Just ignore. */
 			return;
@@ -715,7 +717,7 @@
 
 	case LCHAN_EV_RTP_RELEASED:
 	case LCHAN_EV_RTP_ERROR:
-		if (lchan->release_requested) {
+		if (lchan->in_release_handler) {
 			/* Already in release, the RTP is not the initial cause of failure.
 			 * Just ignore. */
 			return;
@@ -826,7 +828,7 @@
 
 	case LCHAN_EV_RTP_RELEASED:
 	case LCHAN_EV_RTP_ERROR:
-		if (lchan->release_requested) {
+		if (lchan->in_release_handler) {
 			/* Already in release, the RTP is not the initial cause of failure.
 			 * Just ignore. */
 			return;
@@ -1201,6 +1203,11 @@
 {
 	if (!lchan || !lchan->fi)
 		return;
+
+	if (lchan->in_release_handler)
+		return;
+	lchan->in_release_handler = true;
+
 	struct osmo_fsm_inst *fi = lchan->fi;
 	lchan->release_in_error = err;
 	lchan->rsl_error_cause = cause_rr;
@@ -1223,13 +1230,13 @@
 			if (lchan->deact_sacch)
 				rsl_deact_sacch(lchan);
 			lchan_fsm_state_chg(LCHAN_ST_WAIT_RF_RELEASE_ACK);
-			return;
+			goto exit_release_handler;
 		case LCHAN_ST_WAIT_TS_READY:
 			lchan_fsm_state_chg(LCHAN_ST_WAIT_RLL_RTP_RELEASED);
-			return;
+			goto exit_release_handler;
 		case LCHAN_ST_WAIT_RF_RELEASE_ACK:
 		case LCHAN_ST_BORKEN:
-			return;
+			goto exit_release_handler;
 		}
 	}
 
@@ -1237,6 +1244,9 @@
 	 * is: */
 	if (fi->state == LCHAN_ST_ESTABLISHED)
 		lchan_fsm_state_chg(LCHAN_ST_WAIT_RLL_RTP_RELEASED);
+
+exit_release_handler:
+	lchan->in_release_handler = false;
 }
 
 void lchan_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)

-- 
To view, visit https://gerrit.osmocom.org/10104
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: Iec41e006b6ab9d0f618d36925341f9536353e5d8
Gerrit-Change-Number: 10104
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/20180723/29ca6af4/attachment.htm>


More information about the gerrit-log mailing list