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

Jenkins2 asteriskteam at digium.com
Wed Dec 20 07:47:23 CST 2017


Jenkins2 has submitted this change and it was merged. ( 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(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



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: merged
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>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171220/f0767080/attachment.html>


More information about the asterisk-code-review mailing list