summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-12-20 07:55:33 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-12-20 07:55:33 -0600
commit78fb99e5a30b6301bc17da966f0f8007ae091975 (patch)
tree7808172bb85b608b25781482d51cfe647209f536 /res
parent968993a297df673954dbd19c5ef41804ff98e267 (diff)
parent81474dfb23bae6bdf6a559951150766472c14d92 (diff)
Merge "res_rtp_asterisk: Avoid close the rtp/rtcp fd twice."
Diffstat (limited to 'res')
-rw-r--r--res/res_rtp_asterisk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 51e509c77..913fbad1c 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -3481,6 +3481,7 @@ static int rtp_allocate_transport(struct ast_rtp_instance *instance, struct ast_
static void rtp_deallocate_transport(struct ast_rtp_instance *instance, struct ast_rtp *rtp)
{
+ int saved_rtp_s = rtp->s;
#ifdef HAVE_PJPROJECT
struct timeval wait = ast_tvadd(ast_tvnow(), ast_samp2tv(TURN_STATE_WAIT_TIME, 1000));
struct timespec ts = { .tv_sec = wait.tv_sec, .tv_nsec = wait.tv_usec * 1000, };
@@ -3498,7 +3499,9 @@ static void rtp_deallocate_transport(struct ast_rtp_instance *instance, struct a
/* Destroy RTCP if it was being used */
if (rtp->rtcp && rtp->rtcp->s > -1) {
- close(rtp->rtcp->s);
+ if (saved_rtp_s != rtp->rtcp->s) {
+ close(rtp->rtcp->s);
+ }
rtp->rtcp->s = -1;
}