devicestate: Don't create topic when change isn't cached.

When publishing a device state the change can be marked as being
cachable or not. If it is not cached the change is just published
to all interested and not stored away for later query. This was not
fully taken into account when publishing in stasis. The act of
publishing would create a topic for the device even if it may be
ephemeral.

This change makes it so messages which are not cached won't create
a topic for the device. If a topic does already exist it will be
published to but otherwise the change will only be published to
the device state all topic.

ASTERISK-27591

Change-Id: I18da0e8cbb18e79602e731020c46ba4101e59f0a
This commit is contained in:
Joshua Colp
2018-07-25 10:32:31 +00:00
parent 4a51f2792e
commit e5c0ac6a64
3 changed files with 43 additions and 4 deletions

View File

@@ -1196,6 +1196,19 @@ struct stasis_topic *stasis_topic_pool_get_topic(struct stasis_topic_pool *pool,
return topic_pool_entry->topic;
}
int stasis_topic_pool_topic_exists(const struct stasis_topic_pool *pool, const char *topic_name)
{
struct topic_pool_entry *topic_pool_entry;
topic_pool_entry = ao2_find(pool->pool_container, topic_name, OBJ_SEARCH_KEY);
if (!topic_pool_entry) {
return 0;
}
ao2_ref(topic_pool_entry, -1);
return 1;
}
void stasis_log_bad_type_access(const char *name)
{
#ifdef AST_DEVMODE