[Asterisk-code-review] pjsip configuration: On delete, remove the persistent versio... (asterisk[master])
Matt Jordan
asteriskteam at digium.com
Wed Nov 4 07:44:07 CST 2015
Matt Jordan has submitted this change and it was merged.
Change subject: pjsip_configuration: On delete, remove the persistent version of an endpoint
......................................................................
pjsip_configuration: On delete, remove the persistent version of an endpoint
When an endpoint is deleted (such as through an API), the persistent endpoint
currently continues to lurk around. While this isn't harmful from a memory
consumption perspective - as all persistent endpoints are reclaimed on
shutdown - it does cause Stasis endpoint related operations to continue
to believe that the endpoint may or may not exist.
This patch causes the persistent endpoint related to a PJSIP endpoint to be
destroyed if the PJSIP endpoint is deleted.
Change-Id: I85ac707b4d5e6aad882ac275b0c2e2154affa5bb
---
M res/res_pjsip/pjsip_configuration.c
1 file changed, 12 insertions(+), 0 deletions(-)
Approvals:
Anonymous Coward #1000019: Verified
Matt Jordan: Looks good to me, approved
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index aa753f4..3a6f9d7 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -253,6 +253,17 @@
.updated = persistent_endpoint_contact_status_observer,
};
+static void endpoint_deleted_observer(const void *object)
+{
+ const struct ast_sip_endpoint *endpoint = object;
+
+ ao2_find(persistent_endpoints, ast_endpoint_get_resource(endpoint->persistent), OBJ_SEARCH_KEY | OBJ_UNLINK | OBJ_NODATA);
+}
+
+static const struct ast_sorcery_observer endpoint_observers = {
+ .deleted = endpoint_deleted_observer,
+};
+
static int dtmf_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct ast_sip_endpoint *endpoint = obj;
@@ -1955,6 +1966,7 @@
return -1;
}
+ ast_sorcery_observer_add(sip_sorcery, "endpoint", &endpoint_observers);
ast_sorcery_observer_add(sip_sorcery, "contact", &state_contact_observer);
ast_sorcery_observer_add(sip_sorcery, CONTACT_STATUS, &state_contact_status_observer);
--
To view, visit https://gerrit.asterisk.org/1558
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I85ac707b4d5e6aad882ac275b0c2e2154affa5bb
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-code-review
mailing list