[asterisk-commits] mmichelson: branch mmichelson/rls-notify r418153 - /team/mmichelson/rls-notif...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 7 15:53:11 CDT 2014


Author: mmichelson
Date: Mon Jul  7 15:53:07 2014
New Revision: 418153

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418153
Log:
Correct algorithm used for shutting down subscriptions.


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=418153&r1=418152&r2=418153
==============================================================================
--- team/mmichelson/rls-notify/res/res_pjsip_pubsub.c (original)
+++ team/mmichelson/rls-notify/res/res_pjsip_pubsub.c Mon Jul  7 15:53:07 2014
@@ -2485,6 +2485,22 @@
 	return PJ_FALSE;
 }
 
+static void shutdown_subscriptions(struct ast_sip_subscription *sub)
+{
+	if (!AST_LIST_EMPTY(&sub->children)) {
+		struct ast_sip_subscription *iter;
+
+		AST_LIST_TRAVERSE(&sub->children, iter, next) {
+			shutdown_subscriptions(iter);
+		}
+		return;
+	}
+
+	if (sub->handler->subscription_shutdown) {
+		sub->handler->subscription_shutdown(sub);
+	}
+}
+
 static void pubsub_on_evsub_state(pjsip_evsub *evsub, pjsip_event *event)
 {
 	struct ast_sip_subscription *sub;
@@ -2497,9 +2513,8 @@
 		return;
 	}
 
-	if (sub->handler->subscription_shutdown) {
-		sub->handler->subscription_shutdown(sub);
-	}
+	shutdown_subscriptions(sub);
+
 	pjsip_evsub_set_mod_data(evsub, pubsub_module.id, NULL);
 }
 




More information about the asterisk-commits mailing list