summaryrefslogtreecommitdiff
path: root/main/bridging.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-06-07 12:56:56 +0000
committerKinsey Moore <kmoore@digium.com>2013-06-07 12:56:56 +0000
commit759a7e4a30b5e69738670494e5c19b6982a34644 (patch)
tree56e190b02bf90267738a4da3f0c8bb87e55424eb /main/bridging.c
parent611416623748504be81c58b455205a4bc7fff414 (diff)
Rework stasis cache clear events
Stasis cache clear message payloads now consist of a stasis_message representative of the message to be cleared from the cache. This allows multiple parallel caches to coexist and be cleared properly by the same cache clear message even when keyed on different fields. This change fixes a bug where multiple cache clears could be posted for channels. The cache clear is now produced in the destructor instead of ast_hangup. Additionally, dummy channels are no longer capable of producing channel snapshots. Review: https://reviewboard.asterisk.org/r/2596 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/bridging.c')
-rw-r--r--main/bridging.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/main/bridging.c b/main/bridging.c
index d5d17ae9e..6a21c0b64 100644
--- a/main/bridging.c
+++ b/main/bridging.c
@@ -1283,17 +1283,32 @@ static void bridge_handle_actions(struct ast_bridge *bridge)
}
}
+static struct stasis_message *create_bridge_snapshot_message(struct ast_bridge *bridge)
+{
+ RAII_VAR(struct ast_bridge_snapshot *, snapshot, NULL, ao2_cleanup);
+ snapshot = ast_bridge_snapshot_create(bridge);
+ if (!snapshot) {
+ return NULL;
+ }
+
+ return stasis_message_create(ast_bridge_snapshot_type(), snapshot);
+}
+
static void destroy_bridge(void *obj)
{
struct ast_bridge *bridge = obj;
- RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_message *, clear_msg, NULL, ao2_cleanup);
ast_debug(1, "Bridge %s: actually destroying %s bridge, nobody wants it anymore\n",
bridge->uniqueid, bridge->v_table->name);
- msg = stasis_cache_clear_create(ast_bridge_snapshot_type(), bridge->uniqueid);
- if (msg) {
- stasis_publish(ast_bridge_topic(bridge), msg);
+ clear_msg = create_bridge_snapshot_message(bridge);
+ if (clear_msg) {
+ RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+ msg = stasis_cache_clear_create(clear_msg);
+ if (msg) {
+ stasis_publish(ast_bridge_topic(bridge), msg);
+ }
}
/* Do any pending actions in the context of destruction. */