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

Joshua Colp asteriskteam at digium.com
Thu Feb 25 10:04:41 CST 2016


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/2295

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/95/2295/1

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: newchange
Gerrit-Change-Id: Iace2b13641c31bbcc0d43a39f99aba1f340c0f48
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list