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

@@ -600,11 +600,26 @@ struct ast_json *ast_multi_channel_blob_get_json(struct ast_multi_channel_blob *
return obj->blob;
}
void ast_channel_stage_snapshot(struct ast_channel *chan)
{
ast_set_flag(ast_channel_flags(chan), AST_FLAG_SNAPSHOT_STAGE);
}
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
{
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_SNAPSHOT_STAGE);
ast_channel_publish_snapshot(chan);
}
void ast_channel_publish_snapshot(struct ast_channel *chan)
{
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_SNAPSHOT_STAGE)) {
return;
}
snapshot = ast_channel_snapshot_create(chan);
if (!snapshot) {
return;