aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/mgcp/mgcp_protocol.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-06 18:03:11 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-06 18:03:11 +0800
commit39a97e24fb7f5f67813bb4abd99038cd124b9583 (patch)
treeb891c89a81e302fb07e736d8173b60b8dafd7139 /openbsc/src/mgcp/mgcp_protocol.c
parent869e38eced83a73ce95f415d2013f6b648aa16a6 (diff)
mgcp: Remember if the endpoint was allocated...
Do not use the CI_UNUSED to decide if an endpoint is allocated but introduce a new flag. This way only the CRCX and free_endp play with the allocated field.
Diffstat (limited to 'openbsc/src/mgcp/mgcp_protocol.c')
-rw-r--r--openbsc/src/mgcp/mgcp_protocol.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c
index 828c33b98..2aa66a0af 100644
--- a/openbsc/src/mgcp/mgcp_protocol.c
+++ b/openbsc/src/mgcp/mgcp_protocol.c
@@ -430,7 +430,7 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg)
if (found != 0)
return create_response(500, "CRCX", trans_id);
- if (endp->ci != CI_UNUSED) {
+ if (endp->allocated) {
if (cfg->force_realloc) {
LOGP(DMGCP, LOGL_NOTICE, "Endpoint 0x%x already allocated. Forcing realloc.\n",
ENDPOINT_NUMBER(endp));
@@ -487,6 +487,7 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg)
if (endp->ci == CI_UNUSED)
goto error2;
+ endp->allocated = 1;
endp->bts_end.payload_type = cfg->audio_payload;
/* policy CB */
@@ -667,7 +668,7 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg)
if (found != 0)
return create_response(error_code, "DLCX", trans_id);
- if (endp->ci == CI_UNUSED) {
+ if (!endp->allocated) {
LOGP(DMGCP, LOGL_ERROR, "Endpoint is not used. 0x%x\n", ENDPOINT_NUMBER(endp));
return create_response(error_code, "DLCX", trans_id);
}
@@ -811,6 +812,7 @@ void mgcp_free_endp(struct mgcp_endpoint *endp)
{
LOGP(DMGCP, LOGL_DEBUG, "Deleting endpoint on: 0x%x\n", ENDPOINT_NUMBER(endp));
endp->ci = CI_UNUSED;
+ endp->allocated = 0;
if (endp->callid) {
talloc_free(endp->callid);