[asterisk-commits] file: trunk r413141 - in /trunk: ./ channels/chan_pjsip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 30 15:39:21 CDT 2014


Author: file
Date: Wed Apr 30 15:39:17 2014
New Revision: 413141

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=413141
Log:
chan_pjsip: Fix deadlock when retrieving call-id of channel.

If a task was in-flight which required the channel or bridge lock
it was possible for the synchronous task retrieving the call-id
to deadlock as it holds those locks.

After discussing with Mark Michelson the synchronous task was
removed and the call-id accessed directly. This should be safe as
each object involved is guaranteed to exist and the call-id will
never change.
........

Merged revisions 413140 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/channels/chan_pjsip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_pjsip.c?view=diff&rev=413141&r1=413140&r2=413141
==============================================================================
--- trunk/channels/chan_pjsip.c (original)
+++ trunk/channels/chan_pjsip.c Wed Apr 30 15:39:17 2014
@@ -907,34 +907,18 @@
 	return res;
 }
 
-struct uniqueid_data {
-	struct ast_sip_session *session;
-	char *uniqueid;
-};
-
-static int get_uniqueid(void *data)
-{
-	struct uniqueid_data *uid_data = data;
-
-	ast_copy_pj_str(uid_data->uniqueid, &uid_data->session->inv_session->dlg->call_id->id, UNIQUEID_BUFSIZE);
-
-	return 0;
-}
-
 static const char *chan_pjsip_get_uniqueid(struct ast_channel *ast)
 {
 	struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
-	struct uniqueid_data uid_data = {
-		.session = channel->session,
-		.uniqueid = ast_threadstorage_get(&uniqueid_threadbuf, UNIQUEID_BUFSIZE),
-	};
-
-	if (!uid_data.uniqueid ||
-		ast_sip_push_task_synchronous(channel->session->serializer, get_uniqueid, &uid_data)) {
-		return NULL;
-	}
-
-	return uid_data.uniqueid;
+	char *uniqueid = ast_threadstorage_get(&uniqueid_threadbuf, UNIQUEID_BUFSIZE);
+
+	if (!uniqueid) {
+		return "";
+	}
+
+	ast_copy_pj_str(uniqueid, &channel->session->inv_session->dlg->call_id->id, UNIQUEID_BUFSIZE);
+
+	return uniqueid;
 }
 
 struct indicate_data {




More information about the asterisk-commits mailing list