[Asterisk-code-review] res rtp asterisk: Avoid close the rtp/rtcp fd twice. (asterisk[13])

Corey Farrell asteriskteam at digium.com
Tue Dec 19 14:18:05 CST 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7669


Change subject: res_rtp_asterisk:  Avoid close the rtp/rtcp fd twice.
......................................................................

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
---
M res/res_rtp_asterisk.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/69/7669/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 230d147..263dbff 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -3247,7 +3247,9 @@
 		 * 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);
 	}

-- 
To view, visit https://gerrit.asterisk.org/7669
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I870a072d73fd207463ac116ef97100addbc0820a
Gerrit-Change-Number: 7669
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Aaron An <anjb at ti-net.com.cn>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171219/f6d45636/attachment.html>


More information about the asterisk-code-review mailing list