[asterisk-commits] res pjsip pubsub: Move where the subscription is stored to a... (asterisk[certified/13.1])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Feb 28 07:02:03 CST 2016


Joshua Colp has submitted this change and it was merged.

Change subject: res_pjsip_pubsub: Move where the subscription is stored to after initialized.
......................................................................


res_pjsip_pubsub: Move where the subscription is stored to after initialized.

A problem arose when testing the AMI subscription listing actions where it
was possible for a subscription that had not been fully initialized to be
listed. This was problematic as the underlying listing code would crash.

This change makes it so the subscription tree is fully set up before it is
added to the list of subscriptions. This ensures that when the listing actions
get the subscription it is valid.

ASTERISK-25738 #close

Change-Id: Iace2b13641c31bbcc0d43a39f99aba1f340c0f48
(cherry picked from commit 1c4f2a920db173412b38aab785ba22c2cc489f89)
---
M res/res_pjsip_pubsub.c
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Joshua Colp: Verified



diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index fd01190..e297822 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -1241,7 +1241,6 @@
 	sub_tree->endpoint = ao2_bump(endpoint);
 	sub_tree->notify_sched_id = -1;
 
-	add_subscription(sub_tree);
 	return sub_tree;
 }
 
@@ -1314,6 +1313,8 @@
 	if (AST_VECTOR_SIZE(&sub_tree->root->children) > 0) {
 		sub_tree->is_list = 1;
 	}
+
+	add_subscription(sub_tree);
 
 	return sub_tree;
 }
@@ -1602,6 +1603,8 @@
 		return NULL;
 	}
 
+	add_subscription(sub_tree);
+
 	return sub;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/2295
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iace2b13641c31bbcc0d43a39f99aba1f340c0f48
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list