[asterisk-commits] qwell: trunk r55955 - in /trunk: ./ channels/chan_gtalk.c channels/chan_jingle.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Feb 21 13:30:54 MST 2007


Author: qwell
Date: Wed Feb 21 14:30:54 2007
New Revision: 55955

URL: http://svn.digium.com/view/asterisk?view=rev&rev=55955
Log:
Merged revisions 55954 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r55954 | qwell | 2007-02-21 14:27:08 -0600 (Wed, 21 Feb 2007) | 4 lines

Fix locking issue, and accept "transport-accept" as a valid accept message.

This should solve issues 8970 and 8503.

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_gtalk.c
    trunk/channels/chan_jingle.c

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

Modified: trunk/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_gtalk.c?view=diff&rev=55955&r1=55954&r2=55955
==============================================================================
--- trunk/channels/chan_gtalk.c (original)
+++ trunk/channels/chan_gtalk.c Wed Feb 21 14:30:54 2007
@@ -257,6 +257,7 @@
 {
 	struct gtalk *gtalk = NULL;
 	char *domain = NULL , *s = NULL;
+
 	if(strchr(connection, '@')) {
 		s = ast_strdupa(connection);
 		domain = strsep(&s, "@");
@@ -268,20 +269,20 @@
 
 	if (!gtalk) {				/* guest call */
 		ASTOBJ_CONTAINER_TRAVERSE(&gtalk_list, 1, {
-			ASTOBJ_WRLOCK(iterator);
+			ASTOBJ_RDLOCK(iterator);
 			if (!strcasecmp(iterator->name, "guest")) {
 				if (!strcasecmp(iterator->connection->jid->partial, connection)) {
 					gtalk = iterator;
-					break;
 				} else if (!strcasecmp(iterator->connection->name, connection)) {
 					gtalk = iterator;
-					break;
 				} else if (iterator->connection->component && !strcasecmp(iterator->connection->user,domain)) {
 					gtalk = iterator;
-					break;
 				}
 			}
 			ASTOBJ_UNLOCK(iterator);
+
+			if (gtalk)
+				break;
 		});
 
 	}
@@ -1493,10 +1494,12 @@
 		ast_log(LOG_WARNING, "Could not find recipient.\n");
 		return NULL;
 	}
+	ASTOBJ_WRLOCK(client);
 	p = gtalk_alloc(client, strchr(sender, '@') ? sender : client->connection->jid->full, strchr(to, '@') ? to : client->user, NULL);
 	if (p)
 		chan = gtalk_new(client, p, AST_STATE_DOWN, to);
 
+	ASTOBJ_UNLOCK(client);
 	return chan;
 }
 
@@ -1526,13 +1529,13 @@
 	if (iks_find_with_attrib(pak->x, "session", "type", "initiate")) {
 		/* New call */
 		gtalk_newcall(client, pak);
-	} else if (iks_find_with_attrib(pak->x, "session", "type", "candidates") || iks_find_with_attrib(pak->x, "session", "type", "transport-info") ) {
+	} else if (iks_find_with_attrib(pak->x, "session", "type", "candidates") || iks_find_with_attrib(pak->x, "session", "type", "transport-info")) {
 		if (option_debug > 2)
 			ast_log(LOG_DEBUG, "About to add candidate!\n");
 		gtalk_add_candidate(client, pak);
 		if (option_debug > 2)
 			ast_log(LOG_DEBUG, "Candidate Added!\n");
-	} else if (iks_find_with_attrib(pak->x, "session", "type", "accept")) {
+	} else if (iks_find_with_attrib(pak->x, "session", "type", "accept") || iks_find_with_attrib(pak->x, "session", "type", "transport-accept")) {
 		gtalk_is_answered(client, pak);
 	} else if (iks_find_with_attrib(pak->x, "session", "type", "content-info")) {
 		gtalk_handle_dtmf(client, pak);

Modified: trunk/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_jingle.c?view=diff&rev=55955&r1=55954&r2=55955
==============================================================================
--- trunk/channels/chan_jingle.c (original)
+++ trunk/channels/chan_jingle.c Wed Feb 21 14:30:54 2007
@@ -242,17 +242,18 @@
 
 	if (!jingle) {				/* guest call */
 		ASTOBJ_CONTAINER_TRAVERSE(&jingles, 1, {
-			ASTOBJ_WRLOCK(iterator);
+			ASTOBJ_RDLOCK(iterator);
 			if (!strcasecmp(iterator->name, "guest")) {
 				if (!strcasecmp(iterator->connection->jid->partial, connection)) {
 					jingle = iterator;
-					break;
 				} else if (!strcasecmp(iterator->connection->name, connection)) {
 					jingle = iterator;
-					break;
 				}
 			}
 			ASTOBJ_UNLOCK(iterator);
+
+			if (jingle)
+				break;
 		});
 
 	}
@@ -1376,9 +1377,11 @@
 		ast_log(LOG_WARNING, "Could not find recipient.\n");
 		return NULL;
 	}
+	ASTOBJ_WRLOCK(client);
 	p = jingle_alloc(client, to, NULL);
 	if (p)
 		chan = jingle_new(client, p, AST_STATE_DOWN, to);
+	ASTOBJ_UNLOCK(client);
 
 	return chan;
 }



More information about the asterisk-commits mailing list