[asterisk-commits] mmichelson: branch mmichelson/subscription_abstraction r416616 - /team/mmiche...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 18 12:32:15 CDT 2014


Author: mmichelson
Date: Wed Jun 18 12:32:12 2014
New Revision: 416616

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=416616
Log:
Remove esoteric storage of body generators on rdata.


Modified:
    team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c

Modified: team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c?view=diff&rev=416616&r1=416615&r2=416616
==============================================================================
--- team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c (original)
+++ team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c Wed Jun 18 12:32:12 2014
@@ -120,7 +120,6 @@
 	.on_rx_request = pubsub_on_rx_request,
 };
 
-#define MOD_DATA_BODY_GENERATOR "sub_body_generator"
 #define MOD_DATA_PERSISTENCE "sub_persistence"
 
 static const pj_str_t str_event_name = { "Event", 5 };
@@ -470,7 +469,8 @@
 }
 
 static struct ast_sip_subscription *notifier_create_subscription(const struct ast_sip_subscription_handler *handler,
-		struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, const char *resource);
+		struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, const char *resource,
+		struct ast_sip_pubsub_body_generator *generator);
 
 /*! \brief Callback function to perform the actual recreation of a subscription */
 static int subscription_persistence_recreate(void *obj, void *arg, int flags)
@@ -543,13 +543,11 @@
 	}
 
 	ast_sip_mod_data_set(rdata.tp_info.pool, rdata.endpt_info.mod_data,
-			pubsub_module.id, MOD_DATA_BODY_GENERATOR, generator);
-	ast_sip_mod_data_set(rdata.tp_info.pool, rdata.endpt_info.mod_data,
 			pubsub_module.id, MOD_DATA_PERSISTENCE, persistence);
 
 	resp = handler->notifier->new_subscribe(endpoint, resource);
 	if (resp >= 200 && resp < 300) {
-		sub = notifier_create_subscription(handler, endpoint, &rdata, resource);
+		sub = notifier_create_subscription(handler, endpoint, &rdata, resource, generator);
 		sub->persistence = ao2_bump(persistence);
 		subscription_persistence_update(sub, &rdata);
 	} else {
@@ -802,7 +800,8 @@
 }
 
 static struct ast_sip_subscription *notifier_create_subscription(const struct ast_sip_subscription_handler *handler,
-		struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, const char *resource)
+		struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, const char *resource,
+		struct ast_sip_pubsub_body_generator *generator)
 {
 	struct ast_sip_subscription *sub;
 	pjsip_dialog *dlg;
@@ -813,8 +812,7 @@
 		return NULL;
 	}
 
-	sub->body_generator = ast_sip_mod_data_get(rdata->endpt_info.mod_data,
-			pubsub_module.id, MOD_DATA_BODY_GENERATOR);
+	sub->body_generator = generator;
 	dlg = ast_sip_create_dialog_uas(endpoint, rdata);
 	if (!dlg) {
 		ast_log(LOG_WARNING, "Unable to create dialog for SIP subscription\n");
@@ -1327,15 +1325,13 @@
 		return PJ_TRUE;
 	}
 
-	ast_sip_mod_data_set(rdata->tp_info.pool, rdata->endpt_info.mod_data,
-			pubsub_module.id, MOD_DATA_BODY_GENERATOR, generator);
-
 	resp = handler->notifier->new_subscribe(endpoint, resource);
 	if (resp < 200 || resp >= 300) {
 		pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, resp, NULL, NULL, NULL);
 		return PJ_TRUE;
 	}
-	sub = notifier_create_subscription(handler, endpoint, rdata, resource);
+
+	sub = notifier_create_subscription(handler, endpoint, rdata, resource, generator);
 	if (!sub) {
 		pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL);
 	} else {




More information about the asterisk-commits mailing list