[asterisk-commits] mmichelson: branch mmichelson/issue13538 r161826 - in /team/mmichelson/issue1...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 8 14:33:59 CST 2008


Author: mmichelson
Date: Mon Dec  8 14:33:59 2008
New Revision: 161826

URL: http://svn.digium.com/view/asterisk?view=rev&rev=161826
Log:
* Add a missing return to the fixup function
* Change ast_do_masquerade to run datastore fixups
  before moving them from the clone to the original.
* Change the XXX comment in audiohook.c to be more
  affirmative.

The basic test of moving an audiohook during a masquerade
is a success!


Modified:
    team/mmichelson/issue13538/funcs/func_audiohookinherit.c
    team/mmichelson/issue13538/main/audiohook.c
    team/mmichelson/issue13538/main/channel.c

Modified: team/mmichelson/issue13538/funcs/func_audiohookinherit.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/issue13538/funcs/func_audiohookinherit.c?view=diff&rev=161826&r1=161825&r2=161826
==============================================================================
--- team/mmichelson/issue13538/funcs/func_audiohookinherit.c (original)
+++ team/mmichelson/issue13538/funcs/func_audiohookinherit.c Mon Dec  8 14:33:59 2008
@@ -67,12 +67,10 @@
 	if (!new_datastore) {
 		ast_log(LOG_NOTICE, "The new channel has no datastore\n");
 		AST_LIST_TRAVERSE(&old_datastore->allowed_list, old_audiohook, list) {
-			ast_log(LOG_NOTICE, "Going to move audiohook %s from %s to %s\n", old_audiohook->source, old_chan->name, new_chan->name);
 			ast_audiohook_move_by_source(old_chan, new_chan, old_audiohook->source);
-			ast_debug(3, "Moved audiohook %s from %s to %s\n", old_audiohook->source, old_chan->name, new_chan->name);
-		}
-	} else {
-		ast_log(LOG_NOTICE, "There is a datastore on the new channel...\n");
+			ast_debug(3, "Moved audiohook %s from %s(%p) to %s(%p)\n", old_audiohook->source, old_chan->name, old_chan, new_chan->name, new_chan);
+		}
+		return;
 	}
 
 	AST_LIST_TRAVERSE(&old_datastore->allowed_list, old_audiohook, list) {
@@ -83,9 +81,9 @@
 		}
 		if (!new_audiohook) {
 			ast_audiohook_move_by_source(old_chan, new_chan, old_audiohook->source);
-			ast_debug(3, "Moved audiohook %s from %s to %s\n", old_audiohook->source, old_chan->name, new_chan->name);
+			ast_debug(3, "Moved audiohook %s from %s(%p) to %s(%p)\n", old_audiohook->source, old_chan->name, old_chan, new_chan->name, new_chan);
 		} else {
-			ast_debug(3, "Audiohook %s prevented from being moved from %s to %s\n", old_audiohook->source, old_chan->name, new_chan->name);
+			ast_debug(3, "Audiohook %s prevented from being moved from %s(%p) to %s(%p)\n", old_audiohook->source, old_chan->name, old_chan, new_chan->name, new_chan);
 		}
 	}
 }

Modified: team/mmichelson/issue13538/main/audiohook.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/issue13538/main/audiohook.c?view=diff&rev=161826&r1=161825&r2=161826
==============================================================================
--- team/mmichelson/issue13538/main/audiohook.c (original)
+++ team/mmichelson/issue13538/main/audiohook.c Mon Dec  8 14:33:59 2008
@@ -447,9 +447,10 @@
 		return;
 	}
 	
-	/*XXX Hopefully all this locking will help to prevent
-	 * the audiohook from being killed off when its state is
-	 * changed during the removal
+	/* By locking both channels and the audiohook, we can assure that
+	 * another thread will not have a chance to read the audiohook's status
+	 * as done, even though ast_audiohook_remove signals the trigger
+	 * condition
 	 */
 	ast_channel_lock(old_chan);
 	ast_channel_lock(new_chan);

Modified: team/mmichelson/issue13538/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/issue13538/main/channel.c?view=diff&rev=161826&r1=161825&r2=161826
==============================================================================
--- team/mmichelson/issue13538/main/channel.c (original)
+++ team/mmichelson/issue13538/main/channel.c Mon Dec  8 14:33:59 2008
@@ -3975,11 +3975,11 @@
 	/* Move data stores over */
 	if (AST_LIST_FIRST(&clonechan->datastores)) {
 		struct ast_datastore *ds;
-		AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry);
-		AST_LIST_TRAVERSE(&original->datastores, ds, entry) {
+		AST_LIST_TRAVERSE(&clonechan->datastores, ds, entry) {
 			if (ds->info->chan_fixup)
 				ds->info->chan_fixup(ds->data, clonechan, original);
 		}
+		AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry);
 	}
 
 	clone_variables(original, clonechan);




More information about the asterisk-commits mailing list