[asterisk-commits] murf: branch murf/bug11210 r96560 - in /team/murf/bug11210: ./ channels/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 4 14:33:52 CST 2008


Author: murf
Date: Fri Jan  4 14:33:52 2008
New Revision: 96560

URL: http://svn.digium.com/view/asterisk?view=rev&rev=96560
Log:
I see the light! Yes, russellb is right; locking is the key to check_rtp_timeout. It assumes the dialog is locked. duh. Add code to do that. Make sure all places that set pvt->owner to NULL have the pvt locked. Most did.

Modified:
    team/murf/bug11210/Makefile
    team/murf/bug11210/channels/chan_sip.c
    team/murf/bug11210/main/astobj2.c
    team/murf/bug11210/main/sched.c

Modified: team/murf/bug11210/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/Makefile?view=diff&rev=96560&r1=96559&r2=96560
==============================================================================
--- team/murf/bug11210/Makefile (original)
+++ team/murf/bug11210/Makefile Fri Jan  4 14:33:52 2008
@@ -113,8 +113,9 @@
 OVERWRITE=y
 
 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
-DEBUG=-g3 -pg
-ASTLDFLAGS += -pg
+;DEBUG=-g3 -pg
+;ASTLDFLAGS += -pg
+DEBUG=-g3
 
 # Define standard directories for various platforms
 # These apply if they are not redefined in asterisk.conf 

Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=96560&r1=96559&r2=96560
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Fri Jan  4 14:33:52 2008
@@ -4432,7 +4432,9 @@
 		ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);	/* Really hang up next time */
 		p->needdestroy = 0;
 		p->owner->tech_pvt = dialog_unref(p->owner->tech_pvt, "unref p->owner->tech_pvt");
+		sip_pvt_lock(p);
 		p->owner = NULL;  /* Owner will be gone after we return, so take it away */
+		sip_pvt_unlock(p);
 		return 0;
 	}
 
@@ -11712,13 +11714,16 @@
 {
 	struct sip_pvt *dialog = dialogobj;
 	time_t *t = arg;
+	sip_pvt_lock(dialog);
 	
 	/* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */
 	check_rtp_timeout(dialog, *t);
 
 	if (dialog->needdestroy && !dialog->packets && !dialog->owner) {
+		sip_pvt_unlock(dialog);
 		return CMP_MATCH;
 	}
+	sip_pvt_unlock(dialog);
 	return 0;
 }
 
@@ -17606,14 +17611,15 @@
 	return 0;
 }
 
-/*! \brief helper function for the monitoring thread */
+/*! \brief helper function for the monitoring thread -- seems to be called with the assumption that the dialog is locked */
 static void check_rtp_timeout(struct sip_pvt *dialog, time_t t)
 {
 	/* If we have no RTP or no active owner, no need to check timers */
 	if (!dialog->rtp || !dialog->owner)
 		return;
 	/* If the call is not in UP state or redirected outside Asterisk, no need to check timers */
-	if (dialog->owner->_state != AST_STATE_UP || dialog->redirip.sin_addr.s_addr) /* CRASH HERE because dialog->owner is NULL */
+
+	if (!dialog->owner || dialog->owner->_state != AST_STATE_UP || dialog->redirip.sin_addr.s_addr) /* CRASH HERE because dialog->owner is NULL */
 		return;
 
 	/* If the call is involved in a T38 fax session do not check RTP timeout */

Modified: team/murf/bug11210/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/astobj2.c?view=diff&rev=96560&r1=96559&r2=96560
==============================================================================
--- team/murf/bug11210/main/astobj2.c (original)
+++ team/murf/bug11210/main/astobj2.c Fri Jan  4 14:33:52 2008
@@ -565,6 +565,7 @@
  */ 
 static int cb_true(void *user_data, void *arg, int flags)
 {
+	ast_log(LOG_ERROR,"If you see this, something is strange!\n");
 	return CMP_MATCH;
 }
 

Modified: team/murf/bug11210/main/sched.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/sched.c?view=diff&rev=96560&r1=96559&r2=96560
==============================================================================
--- team/murf/bug11210/main/sched.c (original)
+++ team/murf/bug11210/main/sched.c Fri Jan  4 14:33:52 2008
@@ -353,7 +353,6 @@
 #ifdef DO_CRASH
 		CRASH;
 #endif
-		ast_log(LOG_ERROR,"Attempted to delete nonexistent schedule entry %d!\n", id);
 		return -1;
 	}
 	




More information about the asterisk-commits mailing list