nat: Remember a pending delete on an endpoint and carry it out later

This commit is contained in:
Holger Hans Peter Freyther
2010-04-05 22:56:49 +02:00
parent 9d51855f66
commit 5cc94fb86a
2 changed files with 10 additions and 0 deletions

View File

@@ -134,6 +134,8 @@ struct bsc_endpoint {
char *transaction_id;
/* the bsc we are talking to */
struct bsc_connection *bsc;
/* pending delete */
int pending_delete;
};
/**

View File

@@ -150,6 +150,7 @@ int bsc_mgcp_policy_cb(struct mgcp_config *cfg, int endpoint, int state, const c
bsc_endp->transaction_id = talloc_strdup(nat, transaction_id);
bsc_endp->bsc = bsc_con;
bsc_endp->pending_delete = state == MGCP_ENDP_DLCX;
/* we need to update some bits */
if (state == MGCP_ENDP_CRCX) {
@@ -232,6 +233,13 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg)
endp->bts_rtcp = htons(port + 1);
output = bsc_mgcp_rewrite((char * ) msg->l2h, msgb_l2len(msg),
bsc->nat->mgcp_cfg->source_addr, endp->rtp_port);
if (bsc_endp->pending_delete) {
mgcp_free_endp(endp);
bsc_endp->bsc = NULL;
bsc_endp->pending_delete = 0;
}
if (!output) {
LOGP(DMGCP, LOGL_ERROR, "Failed to rewrite MGCP msg.\n");
return;