Reduce channel snapshot creation and publishing by up to 50%.

This change introduces the ability to stage channel snapshot
creation and publishing by suppressing the implicit creation
and publishing that some functions have. Once all operations
are executed the staging is marked as done and a single snapshot
is created and published.

Review: https://reviewboard.asterisk.org/r/2889/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2013-10-02 16:20:25 +00:00
parent 1e22b90efe
commit 1dd63fbdfa
22 changed files with 151 additions and 3 deletions

View File

@@ -876,6 +876,9 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
/* Channel structure allocation failure. */
return NULL;
}
ast_channel_stage_snapshot(tmp);
if (!(nativeformats = ast_format_cap_alloc())) {
ao2_ref(tmp, -1);
/* format capabilities structure allocation failure */
@@ -1020,7 +1023,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
* And now, since the channel structure is built, and has its name, let
* the world know of its existance
*/
ast_channel_publish_snapshot(tmp);
ast_channel_stage_snapshot_done(tmp);
return tmp;
}
@@ -7716,8 +7719,12 @@ void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars)
{
struct ast_variable *cur;
ast_channel_stage_snapshot(chan);
for (cur = vars; cur; cur = cur->next)
pbx_builtin_setvar_helper(chan, cur->name, cur->value);
ast_channel_stage_snapshot_done(chan);
}
static void *silence_generator_alloc(struct ast_channel *chan, void *data)