[MERGED] osmo-bsc[master]: Do not perform assignment, if the new channel equals the cur...

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jan 19 22:09:22 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Do not perform assignment, if the new channel equals the current one
......................................................................


Do not perform assignment, if the new channel equals the current one

This can happen, if a TCH/H was requested, but because it is not available,
a TCH/F is allocated. If the old channel was TCH/F already, it makes no
sense to assign it.

Change-Id: I284125483fc14b8f82e32ee61aa3866746238eae
---
M src/libbsc/bsc_api.c
1 file changed, 12 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libbsc/bsc_api.c b/src/libbsc/bsc_api.c
index ec64bb8..714fc11 100644
--- a/src/libbsc/bsc_api.c
+++ b/src/libbsc/bsc_api.c
@@ -210,7 +210,7 @@
 static int handle_new_assignment(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate)
 {
 	struct gsm_lchan *new_lchan;
-	int chan_type;
+	enum gsm_chan_t chan_type;
 
 	chan_type = full_rate ? GSM_LCHAN_TCH_F : GSM_LCHAN_TCH_H;
 
@@ -221,6 +221,17 @@
 		return -1;
 	}
 
+	/* check if we are on TCH/F and requested TCH/H, but got TCH/F */
+	if (conn->lchan->type == new_lchan->type
+	    && chan_type != new_lchan->type) {
+		LOGP(DHO, LOGL_NOTICE, "%s -> %s Will not re-assign to identical channel type,"
+		     " %s was requested\n",
+		     gsm_lchan_name(conn->lchan), gsm_lchan_name(new_lchan),
+		     gsm_lchant_name(chan_type));
+		lchan_free(new_lchan);
+		return -1;
+	}
+
 	/* copy old data to the new channel */
 	memcpy(&new_lchan->encr, &conn->lchan->encr, sizeof(new_lchan->encr));
 	new_lchan->ms_power = conn->lchan->ms_power;

-- 
To view, visit https://gerrit.osmocom.org/5908
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I284125483fc14b8f82e32ee61aa3866746238eae
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list