[asterisk-commits] mmichelson: branch mmichelson/subscription_abstraction r416651 - /team/mmiche...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 18 15:30:42 CDT 2014


Author: mmichelson
Date: Wed Jun 18 15:30:36 2014
New Revision: 416651

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=416651
Log:
Fix crash on Asterisk shutdown due to my misunderstanding of exten state callbacks.


Modified:
    team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c

Modified: team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c?view=diff&rev=416651&r1=416650&r2=416651
==============================================================================
--- team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c (original)
+++ team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c Wed Jun 18 15:30:36 2014
@@ -200,7 +200,7 @@
 }
 
 static struct notify_task_data *alloc_notify_task_data(char *exten, struct exten_state_subscription *exten_state_sub,
-						       struct ast_state_cb_info *info, int terminate)
+						       struct ast_state_cb_info *info)
 {
 	struct notify_task_data *task_data =
 		ao2_alloc(sizeof(*task_data), notify_task_data_destructor);
@@ -210,7 +210,6 @@
 		return NULL;
 	}
 
-	task_data->terminate = terminate;
 	task_data->exten_state_sub = exten_state_sub;
 	task_data->exten_state_sub->last_exten_state = info->exten_state;
 	task_data->exten_state_sub->last_presence_state = info->presence_state;
@@ -237,6 +236,7 @@
 	    (info->exten_state == AST_EXTENSION_REMOVED)) {
 		ast_log(LOG_WARNING, "Watcher for hint %s %s\n", exten, info->exten_state
 			 == AST_EXTENSION_REMOVED ? "removed" : "deactivated");
+		task_data->terminate = 1;
 	}
 
 	return task_data;
@@ -270,7 +270,7 @@
 	struct notify_task_data *task_data;
 	struct exten_state_subscription *exten_state_sub = data;
 
-	if (!(task_data = alloc_notify_task_data(exten, exten_state_sub, info, 0))) {
+	if (!(task_data = alloc_notify_task_data(exten, exten_state_sub, info))) {
 		return -1;
 	}
 
@@ -287,35 +287,7 @@
 static void state_changed_destroy(int id, void *data)
 {
 	struct exten_state_subscription *exten_state_sub = data;
-	struct ast_state_cb_info info = { 0, };
-	struct notify_task_data *task_data;
-	char *subtype;
-	char *message;
-
-	info.exten_state = ast_extension_state_extended(NULL, exten_state_sub->context,
-			exten_state_sub->exten, &info.device_state_info);
-	info.presence_state = ast_hint_presence_state(NULL, exten_state_sub->context,
-			exten_state_sub->exten, &subtype, &message);
-	info.presence_subtype = subtype;
-	info.presence_message = message;
-
-	task_data = alloc_notify_task_data(exten_state_sub->exten, exten_state_sub, &info, 1);
-	if (!task_data) {
-		goto cleanup;
-	}
-
-	if (ast_sip_push_task(ast_sip_subscription_get_serializer(task_data->exten_state_sub->sip_sub),
-			      notify_task, task_data)) {
-		goto cleanup;
-	}
-
-	return;
-
-cleanup:
-	ao2_cleanup(task_data);
-	ao2_cleanup(info.device_state_info);
-	ast_free(subtype);
-	ast_free(message);
+	ao2_cleanup(exten_state_sub);
 }
 
 static struct ast_datastore_info ds_info = { };




More information about the asterisk-commits mailing list