[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r303767 - in /team/dvossel/f...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 25 11:41:06 CST 2011


Author: dvossel
Date: Tue Jan 25 11:41:01 2011
New Revision: 303767

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=303767
Log:
Fixes issues found while reviewing the code

Modified:
    team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h
    team/dvossel/fixtheworld_phase1_step3/main/format_cap.c
    team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c

Modified: team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h?view=diff&rev=303767&r1=303766&r2=303767
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h Tue Jan 25 11:41:01 2011
@@ -233,6 +233,11 @@
  * }
  * ast_format_cap_iter_end(Cap);
  *
+ * \Note Unless the container was alloced using no_lock, the container
+ * will be locked during the entire iteration until ast_format_cap_iter_end
+ * is called. XXX Remember this, and do not attempt to lock any containers
+ * within this iteration that will violate locking order.
+ *
  * \retval 0 on success, new format is copied into input format struct
  * \retval -1, no more formats are present.
  */

Modified: team/dvossel/fixtheworld_phase1_step3/main/format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/format_cap.c?view=diff&rev=303767&r1=303766&r2=303767
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/format_cap.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/format_cap.c Tue Jan 25 11:41:01 2011
@@ -477,12 +477,18 @@
 
 void ast_format_cap_iter_start(struct ast_format_cap *cap)
 {
+	if (!cap->nolock) {
+		ao2_lock(cap->formats);
+	}
 	cap->it = ao2_iterator_init(cap->formats, cap->nolock ? AO2_ITERATOR_DONTLOCK : 0);
 }
 
 void ast_format_cap_iter_end(struct ast_format_cap *cap)
 {
 	ao2_iterator_destroy(&cap->it);
+	if (!cap->nolock) {
+		ao2_unlock(cap->formats);
+	}
 }
 
 int ast_format_cap_iter_next(struct ast_format_cap *cap, struct ast_format *format)

Modified: team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c?view=diff&rev=303767&r1=303766&r2=303767
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c Tue Jan 25 11:41:01 2011
@@ -1032,7 +1032,9 @@
 	struct ast_sockaddr t1 = {{0,}}, vt1 = {{0,}}, tt1 = {{0,}}, t0 = {{0,}}, vt0 = {{0,}}, tt0 = {{0,}};
 	struct ast_frame *fr = NULL;
 
-	if (!oldcap0 || oldcap1) {
+	if (!oldcap0 || !oldcap1) {
+		ast_channel_unlock(c0);
+		ast_channel_unlock(c1);
 		goto remote_bridge_cleanup;
 	}
 	/* Test the first channel */




More information about the asterisk-commits mailing list