Change in osmo-sgsn[master]: process_ms_ctx_status: refactor to avoid code duplication

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

laforge gerrit-no-reply at lists.osmocom.org
Fri Oct 23 15:11:18 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/20843 )

Change subject: process_ms_ctx_status: refactor to avoid code duplication
......................................................................

process_ms_ctx_status: refactor to avoid code duplication

Change-Id: I1d1a1284c1563b3a5598e79d8ffd544288de4d62
---
M src/sgsn/gprs_gmm.c
1 file changed, 10 insertions(+), 15 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index bf72cd6..0ad6003 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1524,21 +1524,16 @@
 	 * being in state PDP-INACTIVE. */
 
 	llist_for_each_entry_safe(pdp, pdp2, &mmctx->pdp_list, list) {
-		if (pdp->nsapi < 8) {
-			if (!(pdp_status[0] & (1 << pdp->nsapi))) {
-				LOGMMCTXP(LOGL_NOTICE, mmctx, "Dropping PDP context for NSAPI=%u "
-					"due to PDP CTX STATUS IE= 0x%02x%02x\n",
-					pdp->nsapi, pdp_status[1], pdp_status[0]);
-				sgsn_delete_pdp_ctx(pdp);
-			}
-		} else {
-			if (!(pdp_status[1] & (1 << (pdp->nsapi - 8)))) {
-				LOGMMCTXP(LOGL_NOTICE, mmctx, "Dropping PDP context for NSAPI=%u "
-					"due to PDP CTX STATUS IE= 0x%02x%02x\n",
-					pdp->nsapi, pdp_status[1], pdp_status[0]);
-				sgsn_delete_pdp_ctx(pdp);
-			}
-		}
+		bool inactive = (pdp->nsapi < 8) ?
+					!(pdp_status[0] & (1 << pdp->nsapi)) :
+					!(pdp_status[1] & (1 << (pdp->nsapi - 8)));
+		if (!inactive)
+			continue;
+
+		LOGMMCTXP(LOGL_NOTICE, mmctx, "Dropping PDP context for NSAPI=%u "
+			"due to PDP CTX STATUS IE=0x%02x%02x\n",
+			pdp->nsapi, pdp_status[1], pdp_status[0]);
+		sgsn_delete_pdp_ctx(pdp);
 	}
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/20843
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I1d1a1284c1563b3a5598e79d8ffd544288de4d62
Gerrit-Change-Number: 20843
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201023/37b48074/attachment.htm>


More information about the gerrit-log mailing list