[asterisk-commits] mmichelson: branch mmichelson/pool_shark r381009 - in /team/mmichelson/pool_s...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 6 16:37:15 CST 2013


Author: mmichelson
Date: Wed Feb  6 16:37:11 2013
New Revision: 381009

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381009
Log:
Address Joshua's review feedback.


Modified:
    team/mmichelson/pool_shark/channels/chan_gulp.c
    team/mmichelson/pool_shark/include/asterisk/res_sip.h
    team/mmichelson/pool_shark/res/res_sip_session.c

Modified: team/mmichelson/pool_shark/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/channels/chan_gulp.c?view=diff&rev=381009&r1=381008&r2=381009
==============================================================================
--- team/mmichelson/pool_shark/channels/chan_gulp.c (original)
+++ team/mmichelson/pool_shark/channels/chan_gulp.c Wed Feb  6 16:37:11 2013
@@ -426,14 +426,14 @@
 
 	if (!res && response_code) {
 		struct indicate_data *ind_data = indicate_data_alloc(session, condition, response_code, data, datalen);
-		if (!ind_data) {
-			res = -1;
-		} else {
+		if (ind_data) {
 			res = ast_sip_push_task(session->work, indicate, ind_data);
 			if (res) {
 				ast_log(LOG_NOTICE, "Unable to push indication task to the threadpool\n");
 				ao2_cleanup(ind_data);
 			}
+		} else {
+			res = -1;
 		}
 	}
 
@@ -504,8 +504,8 @@
 	struct ast_sip_session *session = ast_channel_tech_pvt(ast);
 
 	ao2_ref(session, +1);
-	if (ast_sip_push_task(session->work, call, session)) {
-		ast_log(LOG_WARNING, "Unable to push call task into the threadpool. Unable to call '%s'\n", dest);
+	if (ast_sip_push_task_synchronous(session->work, call, session)) {
+		ast_log(LOG_WARNING, "Error attempting to place outbound call to call '%s'\n", dest);
 		ao2_cleanup(session);
 		return -1;
 	}

Modified: team/mmichelson/pool_shark/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/include/asterisk/res_sip.h?view=diff&rev=381009&r1=381008&r2=381009
==============================================================================
--- team/mmichelson/pool_shark/include/asterisk/res_sip.h (original)
+++ team/mmichelson/pool_shark/include/asterisk/res_sip.h Wed Feb  6 16:37:11 2013
@@ -530,7 +530,7 @@
  * \brief Pushes a task to SIP servants
  *
  * This uses the SIP work provided to determine how to push the task.
- * If the work param is NULL, then the task will be pushe to the
+ * If the work param is NULL, then the task will be pushed to the
  * servants directly. If the work is non-NULL, then the task will be
  * queued behind other tasks associated with the work.
  *

Modified: team/mmichelson/pool_shark/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/res/res_sip_session.c?view=diff&rev=381009&r1=381008&r2=381009
==============================================================================
--- team/mmichelson/pool_shark/res/res_sip_session.c (original)
+++ team/mmichelson/pool_shark/res/res_sip_session.c Wed Feb  6 16:37:11 2013
@@ -1229,7 +1229,7 @@
 	 * task synchronously
 	 */
 	if (ast_sip_push_task_synchronous(session->work, on_rx_offer, &orod)) {
-		ast_log(LOG_WARNING, "Synchronous threadpool task to create SDP answer failed. A crash may occur\n");
+		ast_log(LOG_WARNING, "Synchronous threadpool task to create SDP answer failed. Using saved local SDP\n");
 	}
 }
 
@@ -1241,18 +1241,24 @@
 #endif
 
 struct media_update_data {
-	pjsip_inv_session *inv;
+	struct ast_sip_session *session;
 	pj_status_t status;
 };
 
-static struct media_update_data *media_update_data_alloc(pjsip_inv_session *inv, pj_status_t status)
-{
-	struct media_update_data *mud = ao2_alloc(sizeof(*mud), NULL);
+static void media_update_data_destroy(void *obj)
+{
+	struct media_update_data *mud = obj;
+	ao2_cleanup(mud->session);
+}
+
+static struct media_update_data *media_update_data_alloc(struct ast_sip_session *session, pj_status_t status)
+{
+	struct media_update_data *mud = ao2_alloc(sizeof(*mud), media_update_data_destroy);
 	if (!mud) {
 		return NULL;
 	}
-	/* XXX Maybe bump the dialog refcount? */
-	mud->inv = inv;
+	ao2_ref(session, +1);
+	mud->session = session;
 	mud->status = status;
 	return mud;
 }
@@ -1260,8 +1266,8 @@
 static int on_media_update(void *data)
 {
 	struct media_update_data *mud = data;
-	struct pjsip_inv_session *inv = mud->inv;
-	struct ast_sip_session *session = inv->mod_data[session_module.id];
+	struct ast_sip_session *session = mud->session;
+	struct pjsip_inv_session *inv = session->inv_session;
 	const pjmedia_sdp_session *remote;
 
 	/* TODO: Split up handling of incoming and actual applying */
@@ -1274,7 +1280,7 @@
 static void session_inv_on_media_update(pjsip_inv_session *inv, pj_status_t status)
 {
 	struct ast_sip_session *session = inv->mod_data[session_module.id];
-	struct media_update_data *mud = media_update_data_alloc(inv, status);
+	struct media_update_data *mud = media_update_data_alloc(session, status);
 	if (!mud) {
 		return;
 	}




More information about the asterisk-commits mailing list