[Asterisk-code-review] res rtp asterisk: Prevent simultaneous access to DTLS SSL co... (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Tue Jul 7 14:21:19 CDT 2015


Richard Mudgett has posted comments on this change.

Change subject: res_rtp_asterisk: Prevent simultaneous access to DTLS SSL context.
......................................................................


Patch Set 4: Code-Review-1

(2 comments)

https://gerrit.asterisk.org/#/c/787/4/res/res_rtp_asterisk.c
File res/res_rtp_asterisk.c:

Line 207: 	ast_mutex_t lock; /*!< Lock for timeout timer synchronization */
This lock is no longer used to ensure the integrity of the timer itself but to hold off __rtp_recvfrom() until dtls_perform_handshake() completes.

I think you can also get away with only one dtls lock per ast_rtp instance instead of one per dtls_details instance.  Simply lock before calling dtls_perform_handshake for rtp and rtcp:

ast_mutex_lock(rtp->dtls_lock)
dtls_perform_handshake(instance, rtp->dtls, 0)
if (rtp->rtcp)
  dtls_perform_handshake(instance, rtp->rtcp->dtls, 1)
ast_mutex_unlock(rtp->dtls_lock)


Line 1844: 	if (!AST_SCHED_DEL(rtp->sched, dtls->timeout_timer)) {
This should be using AST_SCHED_DEL_UNREF() to avoid potential unref too many times.  AST_SCHED_DEL returns 0 if the item wasn't running or if it had to wait for the item to complete executing while the item may or may not have tried to reschedule.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib75ea2546f29d6efc3d2d37c58df6986c7bd9b91
Gerrit-PatchSet: 4
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list