[asterisk-commits] mmichelson: branch mmichelson/pub_sub r385824 - /team/mmichelson/pub_sub/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 15 17:09:07 CDT 2013


Author: mmichelson
Date: Mon Apr 15 17:09:06 2013
New Revision: 385824

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385824
Log:
Push timer-based subscription callbacks into the serializer.


Modified:
    team/mmichelson/pub_sub/res/res_sip_pubsub.c

Modified: team/mmichelson/pub_sub/res/res_sip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/res/res_sip_pubsub.c?view=diff&rev=385824&r1=385823&r2=385824
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip_pubsub.c (original)
+++ team/mmichelson/pub_sub/res/res_sip_pubsub.c Mon Apr 15 17:09:06 2013
@@ -542,18 +542,38 @@
 			res_hdr, p_body, response_data);
 }
 
+static int serialized_pubsub_on_client_refresh(void *userdata)
+{
+	struct ast_sip_subscription *sub = userdata;
+
+	sub->handler->refresh_subscription(sub);
+	ao2_cleanup(sub);
+	return 0;
+}
+
 static void pubsub_on_client_refresh(pjsip_evsub *evsub)
 {
 	struct ast_sip_subscription *sub = pjsip_evsub_get_mod_data(evsub, sub_module.id);
 
-	sub->handler->refresh_subscription(sub);
+	ao2_ref(sub, +1);
+	ast_sip_push_task(sub->serializer, serialized_pubsub_on_client_refresh, sub);
+}
+
+static int serialized_pubsub_on_server_timeout(void *userdata)
+{
+	struct ast_sip_subscription *sub = userdata;
+
+	sub->handler->subscription_timeout(sub);
+	ao2_cleanup(sub);
+	return 0;
 }
 
 static void pubsub_on_server_timeout(pjsip_evsub *evsub)
 {
 	struct ast_sip_subscription *sub = pjsip_evsub_get_mod_data(evsub, sub_module.id);
 
-	sub->handler->subscription_timeout(sub);
+	ao2_ref(sub, +1);
+	ast_sip_push_task(sub->serializer, serialized_pubsub_on_server_timeout, sub);
 }
 
 static int load_module(void)




More information about the asterisk-commits mailing list