diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-13 17:11:37 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-13 17:11:37 +0000 |
commit | 75b54ab02a3ec331d673ebd4c07e686d46e40987 (patch) | |
tree | de6dbdacb0b15ac3bdd5cae19e454a7313db0d79 /channels | |
parent | cb34928104d56aa8dac446b903b3d72c4ebda61d (diff) |
Destroy RTP fds when we schedule final dialog destruction
Since we are only keeping the dialog around for retransmissions at this point
and there is no possibility that we are still handling RTP, go ahead and
destroy the RTP sessions. Keeping them alive for 32 past when they are used
is unnecessary and can lead to problems with having too many open file
descriptors, etc.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@275998 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 31 | ||||
-rw-r--r-- | channels/sip/include/dialog.h | 4 |
2 files changed, 26 insertions, 9 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 750ade278..05bdc5eb2 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3497,6 +3497,23 @@ static int __sip_autodestruct(const void *data) return 0; } +/*! \brief Destroy all RTP instances allocated for a dialog */ +void sip_destroy_rtp(struct sip_pvt *p) +{ + if (p->rtp) { + ast_rtp_instance_destroy(p->rtp); + p->rtp = NULL; + } + if (p->vrtp) { + ast_rtp_instance_destroy(p->vrtp); + p->vrtp = NULL; + } + if (p->trtp) { + ast_rtp_instance_destroy(p->trtp); + p->trtp = NULL; + } +} + /*! \brief Schedule final destruction of SIP dialog. This can not be canceled. * This function is used to keep a dialog around for a period of time in order * to properly respond to any retransmits. */ @@ -3510,6 +3527,8 @@ void sip_scheddestroy_final(struct sip_pvt *p, int ms) if (p->autokillid != -1) { p->final_destruction_scheduled = 1; } + + sip_destroy_rtp(p); } /*! \brief Schedule destruction of SIP dialog */ @@ -5176,15 +5195,9 @@ void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist) ast_free(p->notify->content); ast_free(p->notify); } - if (p->rtp) { - ast_rtp_instance_destroy(p->rtp); - } - if (p->vrtp) { - ast_rtp_instance_destroy(p->vrtp); - } - if (p->trtp) { - ast_rtp_instance_destroy(p->trtp); - } + + sip_destroy_rtp(p); + if (p->udptl) ast_udptl_destroy(p->udptl); if (p->refer) diff --git a/channels/sip/include/dialog.h b/channels/sip/include/dialog.h index ed31b7774..08dd6d3f0 100644 --- a/channels/sip/include/dialog.h +++ b/channels/sip/include/dialog.h @@ -40,6 +40,10 @@ void sip_scheddestroy_final(struct sip_pvt *p, int ms); void sip_scheddestroy(struct sip_pvt *p, int ms); int sip_cancel_destroy(struct sip_pvt *p); +/*! \brief Destroy the RTP instances associated with a dialog + */ +void sip_destroy_rtp(struct sip_pvt *p); + /*! \brief Destroy SIP call structure. * Make it return NULL so the caller can do things like * foo = sip_destroy(foo); |