diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-02-26 13:27:51 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-02-26 13:30:23 +0100 |
commit | 154b9553f758b5a1764097a7cd225d75976c5799 (patch) | |
tree | a0e988fa02809533ef8828f4105885ae5970b62d /openbsc/src/mgcp | |
parent | 590cd98842effb1118bb10e5daef99c43029003b (diff) |
[mgcp] Add a method to free the endpoint.
Diffstat (limited to 'openbsc/src/mgcp')
-rw-r--r-- | openbsc/src/mgcp/mgcp_protocol.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c index aaa9bc582..cc37e0cd6 100644 --- a/openbsc/src/mgcp/mgcp_protocol.c +++ b/openbsc/src/mgcp/mgcp_protocol.c @@ -600,19 +600,8 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg) } MSG_TOKENIZE_END - /* free the connection */ - LOGP(DMGCP, LOGL_NOTICE, "Deleting endpoint on: 0x%x\n", ENDPOINT_NUMBER(endp)); - endp->ci= CI_UNUSED; - talloc_free(endp->callid); - talloc_free(endp->local_options); - - if (!cfg->early_bind) { - bsc_unregister_fd(&endp->local_rtp); - bsc_unregister_fd(&endp->local_rtcp); - } - - endp->net_rtp = endp->net_rtcp = endp->bts_rtp = endp->bts_rtcp = 0; + mgcp_free_endp(endp); if (cfg->change_cb) cfg->change_cb(cfg, ENDPOINT_NUMBER(endp), MGCP_ENDP_DLCX, endp->rtp_port); @@ -667,3 +656,27 @@ int mgcp_endpoints_allocate(struct mgcp_config *cfg) return 0; } + +void mgcp_free_endp(struct mgcp_endpoint *endp) +{ + LOGP(DMGCP, LOGL_NOTICE, "Deleting endpoint on: 0x%x\n", ENDPOINT_NUMBER(endp)); + endp->ci= CI_UNUSED; + + if (endp->callid) { + talloc_free(endp->callid); + endp->callid = NULL; + } + + if (endp->local_options) { + talloc_free(endp->local_options); + endp->callid = NULL; + } + + if (!endp->cfg->early_bind) { + bsc_unregister_fd(&endp->local_rtp); + bsc_unregister_fd(&endp->local_rtcp); + } + + endp->net_rtp = endp->net_rtcp = endp->bts_rtp = endp->bts_rtcp = 0; + endp->net_payload_type = endp->bts_payload_type = -1; +} |