diff options
Diffstat (limited to 'res/res_sorcery_memory_cache.c')
-rw-r--r-- | res/res_sorcery_memory_cache.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/res/res_sorcery_memory_cache.c b/res/res_sorcery_memory_cache.c index 57feb8f4f..451d2307a 100644 --- a/res/res_sorcery_memory_cache.c +++ b/res/res_sorcery_memory_cache.c @@ -418,6 +418,9 @@ static int remove_from_cache(struct sorcery_memory_cache *cache, const char *id, if (!hash_object) { return -1; } + + ast_assert(!strcmp(ast_sorcery_object_get_id(hash_object->object), id)); + oldest_object = ast_heap_peek(cache->object_heap, 1); heap_object = ast_heap_remove(cache->object_heap, hash_object); @@ -537,6 +540,8 @@ static int mark_object_as_stale_in_cache(struct sorcery_memory_cache *cache, con return -1; } + ast_assert(!strcmp(ast_sorcery_object_get_id(cached->object), id)); + object_stale_callback(cached, cache, 0); ao2_ref(cached, -1); @@ -718,6 +723,7 @@ static int sorcery_memory_cache_create(const struct ast_sorcery *sorcery, void * ao2_unlock(cache->objects); return -1; } + ast_assert(ao2_container_count(cache->objects) != cache->maximum_objects); } if (add_to_cache(cache, cached)) { ast_log(LOG_ERROR, "Unable to add object '%s' to the cache\n", @@ -826,6 +832,8 @@ static void *sorcery_memory_cache_retrieve_id(const struct ast_sorcery *sorcery, return NULL; } + ast_assert(!strcmp(ast_sorcery_object_get_id(cached->object), id)); + if (cache->object_lifetime_stale) { struct timeval elapsed; |