SoupSession: Handle CONNECT failure without hanging
authorDan Winship <danw@gnome.org>
Sat, 19 Dec 2009 14:14:00 +0000 (15:14 +0100)
committerDan Winship <danw@gnome.org>
Sat, 19 Dec 2009 14:14:00 +0000 (15:14 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=587528

libsoup/soup-session.c

index c6d8765..2b13228 100644 (file)
@@ -1230,10 +1230,14 @@ soup_session_connection_failed (SoupSession *session,
        g_mutex_lock (priv->host_lock);
        host = g_hash_table_lookup (priv->conns, conn);
        g_mutex_unlock (priv->host_lock);
-       if (!host)
-               return;
 
-       connection_disconnected (conn, session);
+       if (host)
+               connection_disconnected (conn, session);
+       else {
+               host = g_object_get_data (G_OBJECT (conn), "SoupSessionHost");
+               if (!host)
+                       return;
+       }
 
        /* Cancel any other messages waiting for a connection to it,
         * since they're out of luck.
@@ -1408,6 +1412,7 @@ soup_session_get_connection (SoupSession *session,
                SOUP_CONNECTION_TIMEOUT, priv->io_timeout,
                SOUP_CONNECTION_IDLE_TIMEOUT, priv->idle_timeout,
                NULL);
+       g_object_set_data (G_OBJECT (conn), "SoupSessionHost", host);
        g_signal_connect (conn, "disconnected",
                          G_CALLBACK (connection_disconnected),
                          session);