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
This commit is contained in:
parent
d0756b152b
commit
782ccec526
|
@ -158,15 +158,7 @@ static void _handle_error(struct mgcp_ctx *mgcp_ctx, enum msc_mgcp_cause_code ca
|
||||||
{
|
{
|
||||||
bool dlcx_possible = true;
|
bool dlcx_possible = true;
|
||||||
struct osmo_fsm_inst *fi;
|
struct osmo_fsm_inst *fi;
|
||||||
struct gsm_mncc mncc = {
|
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
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
OSMO_ASSERT(mgcp_ctx);
|
OSMO_ASSERT(mgcp_ctx);
|
||||||
fi = mgcp_ctx->fsm;
|
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
|
* silent because we already got informed and the higher layers might
|
||||||
* already freed their context information (trans). */
|
* already freed their context information (trans). */
|
||||||
if (!mgcp_ctx->free_ctx) {
|
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,
|
mncc_set_cause(&mncc, GSM48_CAUSE_LOC_TRANS_NET,
|
||||||
GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
|
GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
|
||||||
mncc_tx_to_cc(mgcp_ctx->trans->net, MNCC_REL_REQ, &mncc);
|
mncc_tx_to_cc(mgcp_ctx->trans->net, MNCC_REL_REQ, &mncc);
|
||||||
|
|
Loading…
Reference in New Issue