summaryrefslogtreecommitdiff
path: root/res/ari/resource_events.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-08-18 15:07:49 -0500
committerRichard Mudgett <rmudgett@digium.com>2015-08-18 16:44:06 -0500
commit03eb6cbc10df61064fda2a3890d82ef04f3a0c6a (patch)
tree18b4ce8f50eabfe9ada14023f52dc0590378e484 /res/ari/resource_events.c
parente1e7e205bce3d177601ccfa25edd3391d623511a (diff)
res_ari_events: Fix shutdown ref leak.
ASTERISK-25308 #close Reported by: Joshua Colp Change-Id: I592785bf70ff4b63d00e535b482f40da8e82a082
Diffstat (limited to 'res/ari/resource_events.c')
-rw-r--r--res/ari/resource_events.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/res/ari/resource_events.c b/res/ari/resource_events.c
index f1342b7fa..deb7f9cc0 100644
--- a/res/ari/resource_events.c
+++ b/res/ari/resource_events.c
@@ -103,12 +103,12 @@ static void stasis_app_message_handler(
msg_type,
msg_application);
} else if (!session->ws_session) {
- /* If the websocket is NULL, the message goes to the queue */
- AST_VECTOR_APPEND(&session->message_queue, message);
- ast_log(LOG_WARNING,
- "Queued '%s' message for Stasis app '%s'; websocket is not ready\n",
- msg_type,
- msg_application);
+ /* If the websocket is NULL, the message goes to the queue */
+ AST_VECTOR_APPEND(&session->message_queue, message);
+ ast_log(LOG_WARNING,
+ "Queued '%s' message for Stasis app '%s'; websocket is not ready\n",
+ msg_type,
+ msg_application);
} else {
/* We are ready to publish the message */
ast_ari_websocket_session_write(session->ws_session, message);
@@ -426,13 +426,18 @@ static int event_session_alloc(struct ast_tcptls_session_instance *ser,
return 0;
}
+void ast_ari_websocket_events_event_websocket_dtor(void)
+{
+ ao2_cleanup(event_session_registry);
+ event_session_registry = NULL;
+}
+
int ast_ari_websocket_events_event_websocket_init(void)
{
/* Try to instantiate the registry */
event_session_registry = ao2_container_alloc(EVENT_SESSION_NUM_BUCKETS,
event_session_hash,
event_session_compare);
-
if (!event_session_registry) {
/* This is bad, bad. */
ast_log(LOG_WARNING,