mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
Stasis: Allow message types to be blocked
This introduces stasis.conf and a mechanism to prevent certain message types from being published. Internally, this works by preventing the chosen message types from being created which ensures that those message types can never be published. This patch also adjusts message publishers such that message payloads are not created if the related message type is not available. ASTERISK-23943 #close Review: https://reviewboard.asterisk.org/r/3823/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -185,10 +185,13 @@ static struct stasis_cache_entry *cache_entry_create(struct stasis_message_type
|
||||
struct stasis_cache_entry *entry;
|
||||
int is_remote;
|
||||
|
||||
ast_assert(type != NULL);
|
||||
ast_assert(id != NULL);
|
||||
ast_assert(snapshot != NULL);
|
||||
|
||||
if (!type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
entry = ao2_alloc_options(sizeof(*entry), cache_entry_dtor,
|
||||
AO2_ALLOC_OPT_LOCK_NOLOCK);
|
||||
if (!entry) {
|
||||
@@ -550,9 +553,12 @@ struct ao2_container *stasis_cache_get_all(struct stasis_cache *cache, struct st
|
||||
|
||||
ast_assert(cache != NULL);
|
||||
ast_assert(cache->entries != NULL);
|
||||
ast_assert(type != NULL);
|
||||
ast_assert(id != NULL);
|
||||
|
||||
if (!type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
found = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, NULL, NULL);
|
||||
if (!found) {
|
||||
return NULL;
|
||||
@@ -619,9 +625,12 @@ struct stasis_message *stasis_cache_get_by_eid(struct stasis_cache *cache, struc
|
||||
|
||||
ast_assert(cache != NULL);
|
||||
ast_assert(cache->entries != NULL);
|
||||
ast_assert(type != NULL);
|
||||
ast_assert(id != NULL);
|
||||
|
||||
if (!type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ao2_rdlock(cache->entries);
|
||||
|
||||
cached_entry = cache_find(cache->entries, type, id);
|
||||
@@ -752,6 +761,10 @@ static struct stasis_message *update_create(struct stasis_message *old_snapshot,
|
||||
|
||||
ast_assert(old_snapshot != NULL || new_snapshot != NULL);
|
||||
|
||||
if (!stasis_cache_update_type()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
update = ao2_alloc_options(sizeof(*update), stasis_cache_update_dtor,
|
||||
AO2_ALLOC_OPT_LOCK_NOLOCK);
|
||||
if (!update) {
|
||||
|
Reference in New Issue
Block a user