pidgin: cde037f8: Wait to set remote candidates until the ...

maiku at pidgin.im maiku at pidgin.im
Sun Aug 30 00:15:42 EDT 2009


-----------------------------------------------------------------
Revision: cde037f8fe052890ef9e9eee6d447b7622bb8417
Ancestor: caf5d964d03ad07644ddc90b6f483be93a349655
Author: maiku at pidgin.im
Date: 2009-08-30T03:08:27
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/cde037f8fe052890ef9e9eee6d447b7622bb8417

Modified files:
        libpurple/media.c

ChangeLog: 

Wait to set remote candidates until the session has been accepted. This stops
the accepting side from sending a bunch of connectivity packets and "fail"
to connect before the user has accepted.

-------------- next part --------------
============================================================
--- libpurple/media.c	0ae11c4c03babef77a467124e68364c6faa71bff
+++ libpurple/media.c	2442fb00304d8b1f26cfe617755ab655ce16e5d6
@@ -2278,6 +2278,18 @@ purple_media_stream_info(PurpleMedia *me
 					purple_media_to_fs_stream_direction(
 					stream->session->type), NULL);
 			stream->accepted = TRUE;
+
+			if (stream->remote_candidates != NULL) {
+				GError *err = NULL;
+				fs_stream_set_remote_candidates(stream->stream,
+						stream->remote_candidates, &err);
+
+				if (err) {
+					purple_debug_error("media", "Error adding remote"
+							" candidates: %s\n", err->message);
+					g_error_free(err);
+				}
+			}
 		}
 	} else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
 			type == PURPLE_MEDIA_INFO_UNMUTE)) {
@@ -2903,13 +2915,15 @@ purple_media_add_remote_candidates(Purpl
 	stream->remote_candidates = g_list_concat(stream->remote_candidates,
 			purple_media_candidate_list_to_fs(remote_candidates));
 
-	fs_stream_set_remote_candidates(stream->stream,
-			stream->remote_candidates, &err);
+	if (stream->accepted == TRUE) {
+		fs_stream_set_remote_candidates(stream->stream,
+				stream->remote_candidates, &err);
 
-	if (err) {
-		purple_debug_error("media", "Error adding remote"
-				" candidates: %s\n", err->message);
-		g_error_free(err);
+		if (err) {
+			purple_debug_error("media", "Error adding remote"
+					" candidates: %s\n", err->message);
+			g_error_free(err);
+		}
 	}
 #endif
 }


More information about the Commits mailing list