Change in osmo-msc[master]: msc_mgcp: move mncc struct initalization to where its actually needed

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
Mon Oct 8 19:18:56 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11275 )

Change subject: msc_mgcp: move mncc struct initalization to where its actually needed
......................................................................

msc_mgcp: move mncc struct initalization to where its actually needed

The function _handle_error() initalizes a struct gsm_mncc variable
on startup. The initalization accesses mgcp_ctx->trans->callref. All
this is done before the assertion on mgcp_ctx. Later in the code one
finds an if which tests on mgcp_ctx->free_ctx. This is the only part of
the code that accesses the mncc struct variable. We should move the
initalization there as well.

- Move initalization of struct gsm_mncc mncc into the if body
  that uses it.

Change-Id: I86983eabd999c4275dcc0e4a169ef2aa1e33c747
Related: OS#3635
---
M src/libmsc/msc_mgcp.c
1 file changed, 11 insertions(+), 9 deletions(-)

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



diff --git a/src/libmsc/msc_mgcp.c b/src/libmsc/msc_mgcp.c
index acdb785..c2bbe5f 100644
--- a/src/libmsc/msc_mgcp.c
+++ b/src/libmsc/msc_mgcp.c
@@ -158,15 +158,7 @@
 {
 	bool dlcx_possible = true;
 	struct osmo_fsm_inst *fi;
-	struct gsm_mncc mncc = {
-		.msg_type = MNCC_REL_REQ,
-		.callref = mgcp_ctx->trans->callref,
-		.cause = {
-			.location = GSM48_CAUSE_LOC_PRN_S_LU,
-			.coding = 0, /* FIXME */
-			.value = GSM48_CC_CAUSE_RESOURCE_UNAVAIL
-		}
-	};
+	struct gsm_mncc mncc;
 
 	OSMO_ASSERT(mgcp_ctx);
 	fi = mgcp_ctx->fsm;
@@ -188,6 +180,16 @@
 	 * silent because we already got informed and the higher layers might
 	 * already freed their context information (trans). */
 	if (!mgcp_ctx->free_ctx) {
+		mncc = (struct gsm_mncc) {
+			.msg_type = MNCC_REL_REQ,
+			.callref = mgcp_ctx->trans->callref,
+			.cause = {
+				.location = GSM48_CAUSE_LOC_PRN_S_LU,
+				.coding = 0, /* FIXME */
+				.value = GSM48_CC_CAUSE_RESOURCE_UNAVAIL
+			}
+		};
+
 		mncc_set_cause(&mncc, GSM48_CAUSE_LOC_TRANS_NET,
 			       GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
 		mncc_tx_to_cc(mgcp_ctx->trans->net, MNCC_REL_REQ, &mncc);

-- 
To view, visit https://gerrit.osmocom.org/11275
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I86983eabd999c4275dcc0e4a169ef2aa1e33c747
Gerrit-Change-Number: 11275
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181008/2bf87995/attachment.htm>


More information about the gerrit-log mailing list