aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_mgcp_utils.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-24 21:05:18 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:16 +0800
commitfef76122a7698bb1b12122e96304811bb6d066fc (patch)
treee78c48150e20f4e52ad011e5097e731ebf3d80aa /openbsc/src/nat/bsc_mgcp_utils.c
parent3d194d9986594fe27979c797542ebc1b60358b21 (diff)
nat: Release the transaction id earlier, always reset the BSC
In case we can not find the SCCP connection we still want to free any pending transaction ids and reset the BSC inside the endpoint. In most cases this should be already done when the SCCP connection or the whole BSC is gone.
Diffstat (limited to 'openbsc/src/nat/bsc_mgcp_utils.c')
-rw-r--r--openbsc/src/nat/bsc_mgcp_utils.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c
index cb9264dfc..6e28095d0 100644
--- a/openbsc/src/nat/bsc_mgcp_utils.c
+++ b/openbsc/src/nat/bsc_mgcp_utils.c
@@ -196,6 +196,14 @@ int bsc_mgcp_policy_cb(struct mgcp_config *cfg, int endpoint, int state, const c
bsc_endp = &nat->bsc_endpoints[endpoint];
mgcp_endp = &nat->mgcp_cfg->endpoints[endpoint];
+ if (bsc_endp->transaction_id) {
+ LOGP(DMGCP, LOGL_ERROR, "Endpoint 0x%x had pending transaction: '%s'\n",
+ endpoint, bsc_endp->transaction_id);
+ talloc_free(bsc_endp->transaction_id);
+ bsc_endp->transaction_id = NULL;
+ }
+ bsc_endp->bsc = NULL;
+
sccp = bsc_mgcp_find_con(nat, endpoint);
if (!sccp) {
@@ -218,12 +226,6 @@ int bsc_mgcp_policy_cb(struct mgcp_config *cfg, int endpoint, int state, const c
}
}
- if (bsc_endp->transaction_id) {
- LOGP(DMGCP, LOGL_ERROR, "Endpoint 0x%x had pending transaction: '%s'\n",
- endpoint, bsc_endp->transaction_id);
- talloc_free(bsc_endp->transaction_id);
- }
-
/* we need to generate a new and patched message */
bsc_msg = bsc_mgcp_rewrite((char *) nat->mgcp_msg, nat->mgcp_length,
nat->mgcp_cfg->source_addr, mgcp_endp->rtp_port);