[mgcp] Add a method to free the endpoint.
This commit is contained in:
parent
590cd98842
commit
154b9553f7
|
@ -96,6 +96,7 @@ int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg);
|
|||
int mgcp_vty_init(void);
|
||||
int mgcp_endpoints_allocate(struct mgcp_config *cfg);
|
||||
int mgcp_bind_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
|
||||
void mgcp_free_endp(struct mgcp_endpoint *endp);
|
||||
|
||||
/*
|
||||
* format helper functions
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue