[asterisk-commits] mmichelson: branch mmichelson/pool_shark2 r381716 - /team/mmichelson/pool_sha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 18 21:20:07 CST 2013


Author: mmichelson
Date: Mon Feb 18 21:20:04 2013
New Revision: 381716

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381716
Log:
Make incoming OPTIONS handling not push to the threadpool.

With the distributor in place, the only reason to push to the
threadpool on an incoming message is if you need to serialize.
Since we weren't serializing OPTIONS messages, it made no
sense to do any further task pushing.


Modified:
    team/mmichelson/pool_shark2/res/res_sip/sip_options.c

Modified: team/mmichelson/pool_shark2/res/res_sip/sip_options.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/res/res_sip/sip_options.c?view=diff&rev=381716&r1=381715&r2=381716
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip/sip_options.c (original)
+++ team/mmichelson/pool_shark2/res/res_sip/sip_options.c Mon Feb 18 21:20:04 2013
@@ -122,52 +122,18 @@
 	return status;
 }
 
-struct incoming_options_data {
-	pjsip_rx_data *rdata;
-	pjsip_dialog *dialog;
-	struct ast_sip_endpoint *endpoint;
-};
-
-static void incoming_options_data_destroy(void *obj)
-{
-	struct incoming_options_data *iod = obj;
-	if (iod->rdata) {
-		pjsip_rx_data_free_cloned(iod->rdata);
-	}
-	if (iod->dialog) {
-		pjsip_dlg_dec_session(iod->dialog, &options_module);
-	}
-	ao2_cleanup(iod->endpoint);
-}
-
-static struct incoming_options_data *incoming_options_data_alloc(pjsip_rx_data *rdata, pjsip_dialog *dialog)
-{
-	struct incoming_options_data *iod = ao2_alloc(sizeof(*iod), incoming_options_data_destroy);
-	if (!iod) {
-		return NULL;
-	}
-	if (pjsip_rx_data_clone(rdata, 0, &iod->rdata) != PJ_SUCCESS) {
-		ao2_cleanup(iod);
-		return NULL;
-	}
-	if (dialog) {
-		iod->dialog = dialog;
-		pjsip_dlg_inc_session(iod->dialog, &options_module);
-	}
-	iod->endpoint = ast_pjsip_rdata_get_endpoint(rdata);
-	return iod;
-}
-
-static int incoming_options(void *data)
-{
-	RAII_VAR(struct incoming_options_data *, iod, data, ao2_cleanup);
-	struct ast_sip_endpoint *endpoint = iod->endpoint;
+static pj_bool_t options_module_on_rx_request(pjsip_rx_data *rdata)
+{
+	RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
+	pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
 	pjsip_uri *ruri;
 	pjsip_sip_uri *sip_ruri;
-	pjsip_rx_data *rdata = iod->rdata;
-	pjsip_dialog *dlg = iod->dialog;
 	char exten[AST_MAX_EXTENSION];
 
+	if (pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_options_method)) {
+		return PJ_FALSE;
+	}
+	endpoint = ast_pjsip_rdata_get_endpoint(rdata);
 	ast_assert(endpoint != NULL);
 
 	ruri = rdata->msg_info.msg->line.req.uri;
@@ -178,8 +144,6 @@
 	
 	sip_ruri = pjsip_uri_get_uri(ruri);
 	ast_copy_pj_str(exten, &sip_ruri->user, sizeof(exten));
-
-	/* XXX TODO: authenticate the user */
 
 	if (ast_shutting_down()) {
 		send_options_response(rdata, dlg, 503);
@@ -188,27 +152,6 @@
 	} else {
 		send_options_response(rdata, dlg, 200);
 	}
-	return 0;
-}
-
-static pj_bool_t options_module_on_rx_request(pjsip_rx_data *rdata)
-{
-	struct incoming_options_data *iod;
-	pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
-	if (pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_options_method)) {
-		return PJ_FALSE;
-	}
-
-	iod = incoming_options_data_alloc(rdata, dlg);
-	if (!iod) {
-		send_options_response(rdata, dlg, 500);
-		return PJ_TRUE;
-	}
-
-	if (ast_sip_push_task(NULL, incoming_options, iod)) {
-		send_options_response(rdata, dlg, 500);
-	}
-
 	return PJ_TRUE;
 }
 




More information about the asterisk-commits mailing list