[Freeswitch-svn] [commit] r4699 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Tue Mar 20 17:42:02 EDT 2007


Author: anthm
Date: Tue Mar 20 17:42:02 2007
New Revision: 4699

Modified:
   freeswitch/trunk/src/switch_core.c

Log:
update

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Tue Mar 20 17:42:02 2007
@@ -397,8 +397,9 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-static switch_status_t switch_core_media_bug_close(switch_media_bug_t *bp)
+static switch_status_t switch_core_media_bug_close(switch_media_bug_t **bug)
 {
+	switch_media_bug_t *bp = *bug;
 	if (bp) {
 		if (bp->callback) {
 			bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_CLOSE);
@@ -406,6 +407,7 @@
 		}
 		switch_core_media_bug_destroy(bp);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removing BUG from %s\n", switch_channel_get_name(bp->session->channel));
+		*bug = NULL;
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -434,10 +436,7 @@
 			last = bp;
 		}
 		switch_thread_rwlock_unlock(session->bug_rwlock);
-
-		if ((status = switch_core_media_bug_close(bp)) == SWITCH_STATUS_SUCCESS) {
-			*bug = NULL;
-		}
+		status = switch_core_media_bug_close(&bp);
 	}
 
 	return status;
@@ -2225,7 +2224,10 @@
 							switch_mutex_unlock(bp->read_mutex);
 							dp = bp;
 							bp = last;
-							switch_core_media_bug_close(dp);
+							switch_core_media_bug_close(&dp);
+							if (!bp) {
+								break;
+							}
 							continue;
 						}
 					}
@@ -2484,10 +2486,10 @@
 
 		if (session->bugs) {
 			switch_media_bug_t *bp, *dp, *last = NULL;
-			switch_bool_t ok = SWITCH_TRUE;
 
 			switch_thread_rwlock_rdlock(session->bug_rwlock);
 			for (bp = session->bugs; bp; bp = bp->next) {
+				switch_bool_t ok = SWITCH_TRUE;
                 if (!bp->ready) {
                     continue;
                 }
@@ -2518,7 +2520,10 @@
 					}
 					dp = bp;
 					bp = last;
-					switch_core_media_bug_close(dp);
+					switch_core_media_bug_close(&dp);
+					if (!bp) {
+						break;
+					}
 					continue;
 				}
 				last = bp;



More information about the Freeswitch-svn mailing list