[svn-commits] mmichelson: branch mmichelson/rls-notify r418165 - /team/mmichelson/rls-notif...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 7 19:20:45 CDT 2014


Author: mmichelson
Date: Mon Jul  7 19:20:40 2014
New Revision: 418165

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418165
Log:
Fix subscription state during subscription termination.

Error spotted by the unsubscribe testsuite test.


Modified:
    team/mmichelson/rls-notify/res/res_pjsip_pubsub.c

Modified: team/mmichelson/rls-notify/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/rls-notify/res/res_pjsip_pubsub.c?view=diff&rev=418165&r1=418164&r2=418165
==============================================================================
--- team/mmichelson/rls-notify/res/res_pjsip_pubsub.c (original)
+++ team/mmichelson/rls-notify/res/res_pjsip_pubsub.c Mon Jul  7 19:20:40 2014
@@ -2472,6 +2472,16 @@
 	pjsip_evsub_set_mod_data(evsub, pubsub_module.id, NULL);
 }
 
+static void set_state_terminated(struct ast_sip_subscription *sub)
+{
+	int i;
+
+	sub->subscription_state = PJSIP_EVSUB_STATE_TERMINATED;
+	for (i = 0; i < AST_VECTOR_SIZE(&sub->children); ++i) {
+		set_state_terminated(AST_VECTOR_GET(&sub->children, i));
+	}
+}
+
 static void pubsub_on_rx_refresh(pjsip_evsub *evsub, pjsip_rx_data *rdata,
 		int *p_st_code, pj_str_t **p_st_text, pjsip_hdr *res_hdr, pjsip_msg_body **p_body)
 {
@@ -2480,6 +2490,10 @@
 	sub_tree = pjsip_evsub_get_mod_data(evsub, pubsub_module.id);
 	if (!sub_tree) {
 		return;
+	}
+
+	if (pjsip_evsub_get_state(evsub) == PJSIP_EVSUB_STATE_TERMINATED) {
+		set_state_terminated(sub_tree->root);
 	}
 
 	if (send_notify(sub_tree)) {
@@ -2525,16 +2539,6 @@
 
 	ao2_ref(sub_tree, +1);
 	ast_sip_push_task(sub_tree->serializer, serialized_pubsub_on_client_refresh, sub_tree);
-}
-
-static void set_state_terminated(struct ast_sip_subscription *sub)
-{
-	int i;
-
-	sub->subscription_state = PJSIP_EVSUB_STATE_TERMINATED;
-	for (i = 0; i < AST_VECTOR_SIZE(&sub->children); ++i) {
-		set_state_terminated(AST_VECTOR_GET(&sub->children, i));
-	}
 }
 
 static int serialized_pubsub_on_server_timeout(void *userdata)




More information about the svn-commits mailing list