mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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
This commit is contained in:
@@ -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. */
|
||||
|
Reference in New Issue
Block a user