diff options
author | Aaron An <anjb@ti-net.com.cn> | 2017-12-19 15:15:29 -0500 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2017-12-19 15:16:02 -0500 |
commit | c38b750810c27bd026c4ef3760047258eb0b2834 (patch) | |
tree | fe927aab0059b38a0f1b81624115d4040a7b8ac2 | |
parent | dba037d42263288d80a8c98a8b010d7f6721305a (diff) |
res_rtp_asterisk: Avoid close the rtp/rtcp fd twice.
When RTCP-MUX enabled. rtp->s is the same as rtcp->s, check this before
close the file descriptor. Close the FD twice will hangs the asterisk
under heavy load.
ASTERISK-27299 #close
Reported-by: Aaron An
Tested-by: AaronAn
Change-Id: I870a072d73fd207463ac116ef97100addbc0820a
-rw-r--r-- | res/res_rtp_asterisk.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 230d147be..263dbff18 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -3247,7 +3247,9 @@ static int ast_rtp_destroy(struct ast_rtp_instance *instance) * entry at this point since it holds a reference to the * RTP instance while it's active. */ - close(rtp->rtcp->s); + if (rtp->rtcp->s > -1 && rtp->s != rtp->rtcp->s) { + close(rtp->rtcp->s); + } ast_free(rtp->rtcp->local_addr_str); ast_free(rtp->rtcp); } |