diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2018-10-08 17:12:49 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2018-10-08 17:18:37 +0200 |
commit | 782ccec526e93b7e09ae202780b5e11677ba53c1 (patch) | |
tree | c0535b00ed47f4761dc74d323d147d18655b3d12 | |
parent | d0756b152b64f746a52e6a681946fca744aaed40 (diff) |
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
-rw-r--r-- | src/libmsc/msc_mgcp.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/libmsc/msc_mgcp.c b/src/libmsc/msc_mgcp.c index acdb7859e..c2bbe5fc3 100644 --- a/src/libmsc/msc_mgcp.c +++ b/src/libmsc/msc_mgcp.c @@ -158,15 +158,7 @@ static void _handle_error(struct mgcp_ctx *mgcp_ctx, enum msc_mgcp_cause_code ca { 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 @@ static void _handle_error(struct mgcp_ctx *mgcp_ctx, enum msc_mgcp_cause_code ca * 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); |