changeset 15114:4a8c368df4ea

[gaim-migrate @ 17899] Some touchups: * If one of the parallel connection attempts fails immediately (i.e. does not time out) then don't cancel the other one. * Make sure we don't continue on to step 2 of the peer connection process after we kick off the parallel gaim_proxy_connects(). It looks like this would happen most of the time, because the connect_timeout_timer would be added for the verified ip, so it would NOT be added for the client ip, and so we wouldn't hit the "return" call because it happens to be in the same block as the second gaim_timeout_add() call. * Add the connection timeout timer even if the gaim_proxy_connect() to the verified ip returns NULL for some crazy reason. I didn't actually test any of this. I should probably do that when I get home. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 06 Dec 2006 01:29:59 +0000
parents 072987463f90
children c18c02aeb366
files libgaim/protocols/oscar/peer.c
diffstat 1 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/oscar/peer.c	Wed Dec 06 00:57:19 2006 +0000
+++ b/libgaim/protocols/oscar/peer.c	Wed Dec 06 01:29:59 2006 +0000
@@ -513,16 +513,21 @@
 		conn->verified_connect_data = NULL;
 	else
 		conn->client_connect_data = NULL;
-	
+
+	if (source < 0)
+	{
+		if ((conn->verified_connect_data == NULL) &&
+			(conn->client_connect_data == NULL))
+		{
+			/* Our parallel connection attemps have both failed. */
+			peer_connection_trynext(conn);
+		}
+		return;
+	}
+
 	gaim_timeout_remove(conn->connect_timeout_timer);
 	conn->connect_timeout_timer = 0;
 
-	if (source < 0)
-	{
-		peer_connection_trynext(conn);
-		return;
-	}
-	
 	if (verified) {
 		gaim_proxy_connect_cancel(conn->client_connect_data);
 		conn->client_connect_data = NULL;
@@ -530,7 +535,7 @@
 		gaim_proxy_connect_cancel(conn->verified_connect_data);
 		conn->verified_connect_data = NULL;
 	}
-	
+
 	conn->fd = source;
 
 	peer_connection_finalize_connection(conn);
@@ -541,7 +546,7 @@
 {
 	peer_connection_common_established_cb(data, source, error_message, TRUE);
 }
-	
+
 static void
 peer_connection_client_established_cb(gpointer data, gint source, const gchar *error_message)
 {
@@ -688,7 +693,6 @@
  * too long for a user to wait to send a file. I'm also parallelizing
  * requests when possible. The longest we should have to wait now is 10
  * seconds. We shouldn't make it shorter than this.
- * 
  */
 static gboolean
 peer_connection_tooktoolong(gpointer data)
@@ -697,7 +701,7 @@
 
 	conn = data;
 
-	gaim_debug_info("oscar", "Peer connection timed out after 15 seconds.  "
+	gaim_debug_info("oscar", "Peer connection timed out after 5 seconds.  "
 			"Trying next method...\n");
 
 	peer_connection_close(conn);
@@ -749,12 +753,6 @@
 		conn->verified_connect_data = gaim_proxy_connect(NULL, account,
 				conn->verifiedip, conn->port,
 				peer_connection_verified_established_cb, conn);
-		if (conn->verified_connect_data != NULL)
-		{
-			/* Connecting... */
-			conn->connect_timeout_timer = gaim_timeout_add(5000,
-					peer_connection_tooktoolong, conn);
-		}
 
 		if ((conn->verifiedip == NULL) ||
 			strcmp(conn->verifiedip, conn->clientip))
@@ -762,13 +760,15 @@
 			conn->client_connect_data = gaim_proxy_connect(NULL, account,
 					conn->clientip, conn->port,
 					peer_connection_client_established_cb, conn);
-			if (conn->connect_timeout_timer == 0 && conn->verified_connect_data != NULL)
-			{
-				/* Connecting... */
-				conn->connect_timeout_timer = gaim_timeout_add(5000,
-						peer_connection_tooktoolong, conn);
-				return;
-			}
+		}
+
+		if ((conn->verified_connect_data != NULL) ||
+			(conn->client_connect_data != NULL))
+		{
+			/* Connecting... */
+			conn->connect_timeout_timer = gaim_timeout_add(5000,
+					peer_connection_tooktoolong, conn);
+			return;
 		}
 	}