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

Joshua Colp asteriskteam at digium.com
Mon Feb 15 13:01:55 CST 2016


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/2248

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
---
M res/res_pjsip_pubsub.c
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/2248/1

diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index dc7f5ed..bde7075 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -1254,7 +1254,6 @@
 	sub_tree->endpoint = ao2_bump(endpoint);
 	sub_tree->notify_sched_id = -1;
 
-	add_subscription(sub_tree);
 	return sub_tree;
 }
 
@@ -1327,6 +1326,8 @@
 	if (AST_VECTOR_SIZE(&sub_tree->root->children) > 0) {
 		sub_tree->is_list = 1;
 	}
+
+	add_subscription(sub_tree);
 
 	return sub_tree;
 }
@@ -1616,6 +1617,8 @@
 		return NULL;
 	}
 
+	add_subscription(sub_tree);
+
 	return sub;
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iace2b13641c31bbcc0d43a39f99aba1f340c0f48
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list