mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
sorcery: Add support for more intelligent reloading.
Some sorcery objects actually contain dynamic content that can change despite the underlying configuration itself not changing. A good example of this is the res_pjsip_endpoint_identifier_ip module which allows specifying hostnames. While the configuration may not change between reloads the DNS information of the hostnames can. This change adds the ability for a sorcery object to be marked as having dynamic contents which is then taken into account when reloading by the sorcery file based config module. If there is an object with dynamic content then a reload will be forced while if there are none then the existing behavior of not reloading occurs. ASTERISK-29321 Change-Id: I9342dc55be46cc00204533c266a68d972760a0b1
This commit is contained in:
committed by
Joshua Colp
parent
269bb08ea2
commit
a9acbd19f3
@@ -139,6 +139,9 @@ struct ast_sorcery_object {
|
||||
|
||||
/*! \brief Time that the object was created */
|
||||
struct timeval created;
|
||||
|
||||
/*! \brief Whether this object has dynamic contents or not */
|
||||
unsigned int has_dynamic_contents:1;
|
||||
};
|
||||
|
||||
/*! \brief Structure for registered object type */
|
||||
@@ -2366,6 +2369,20 @@ int ast_sorcery_object_set_extended(const void *object, const char *name, const
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int ast_sorcery_object_has_dynamic_contents(const void *object)
|
||||
{
|
||||
const struct ast_sorcery_object_details *details = object;
|
||||
|
||||
return details->object->has_dynamic_contents;
|
||||
}
|
||||
|
||||
void ast_sorcery_object_set_has_dynamic_contents(const void *object)
|
||||
{
|
||||
const struct ast_sorcery_object_details *details = object;
|
||||
|
||||
details->object->has_dynamic_contents = 1;
|
||||
}
|
||||
|
||||
int ast_sorcery_observer_add(const struct ast_sorcery *sorcery, const char *type, const struct ast_sorcery_observer *callbacks)
|
||||
{
|
||||
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
||||
|
Reference in New Issue
Block a user