Fix two bugs (one that pruned too little, one that pruned too much).
authorDan Winship <danw@src.gnome.org>
Wed, 17 Sep 2003 20:16:51 +0000 (20:16 +0000)
committerDan Winship <danw@src.gnome.org>
Wed, 17 Sep 2003 20:16:51 +0000 (20:16 +0000)
* libsoup/soup-session.c (find_oldest_connection): Fix two bugs
(one that pruned too little, one that pruned too much).
(queue_message): When requeuing, don't run the queue;
final_finished will take care of that later.

* libsoup/soup-socket.c (soup_socket_connect, got_address): ref
the socket while waiting for the address to resolve

ChangeLog
libsoup/soup-session.c
libsoup/soup-socket.c

index 1307d92..349e5f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2003-09-17  Dan Winship  <danw@ximian.com>
 
+       * libsoup/soup-session.c (find_oldest_connection): Fix two bugs
+       (one that pruned too little, one that pruned too much).
+       (queue_message): When requeuing, don't run the queue;
+       final_finished will take care of that later.
+
+       * libsoup/soup-socket.c (soup_socket_connect, got_address): ref
+       the socket while waiting for the address to resolve
+
+2003-09-17  Dan Winship  <danw@ximian.com>
+
        * libsoup/soup-connection.c (soup_connection_new): Replaces the
        three previous soup_connection_new* functions and uses gobject
        properties to set the destination and proxy uris.
index fade4d1..b71d214 100644 (file)
@@ -611,8 +611,12 @@ find_oldest_connection (gpointer key, gpointer host, gpointer data)
 {
        SoupConnection *conn = key, **oldest = data;
 
-       if (!oldest || (soup_connection_last_used (conn) <
-                       soup_connection_last_used (*oldest)))
+       /* Don't prune a connection that hasn't even been used yet. */
+       if (soup_connection_last_used (conn) == 0)
+               return;
+
+       if (!*oldest || (soup_connection_last_used (conn) <
+                        soup_connection_last_used (*oldest)))
                *oldest = conn;
 }
 
@@ -811,10 +815,10 @@ static void
 queue_message (SoupSession *session, SoupMessage *req, gboolean requeue)
 {
        req->status = SOUP_MESSAGE_STATUS_QUEUED;
-       if (!requeue)
+       if (!requeue) {
                soup_message_queue_append (session->priv->queue, req);
-
-       run_queue (session, TRUE);
+               run_queue (session, TRUE);
+       }
 }
 
 /**
index 27454e9..c93a93f 100644 (file)
@@ -277,12 +277,15 @@ got_address (SoupAddress *addr, guint status, gpointer user_data)
 
        if (!SOUP_STATUS_IS_SUCCESSFUL (status)) {
                g_signal_emit (sock, signals[CONNECT_RESULT], 0, status);
+               g_object_unref (sock);
                return;
        }
 
        soup_socket_connect (sock, sock->priv->remote_addr);
        /* soup_socket_connect re-reffed addr */
        g_object_unref (addr);
+
+       g_object_unref (sock);
 }
 
 /**
@@ -327,6 +330,7 @@ soup_socket_connect (SoupSocket *sock, SoupAddress *remote_addr)
                if (sync)
                        return SOUP_STATUS_CANT_RESOLVE;
 
+               g_object_ref (sock);
                soup_address_resolve_async (remote_addr, got_address, sock);
                return SOUP_STATUS_CONTINUE;
        }