[libsoup] Fix connection states so in-use connections don't get pruned



commit ceceaa912cd02660eecacd52d9a1ffc4d15c3c00
Author: Dan Winship <danw gnome org>
Date:   Wed Jun 9 14:34:50 2010 -0400

    Fix connection states so in-use connections don't get pruned
    
    Since connections are assigned to messages before they're connected
    now, they should go to IN_USE after connecting, not IDLE. Otherwise
    the idle-connection-closing code might close connections that existing
    queue items were planning to use.

 libsoup/soup-connection.c    |    4 ++--
 libsoup/soup-session-async.c |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 159d570..c9a4841 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -446,7 +446,7 @@ socket_connect_result (SoupSocket *sock, guint status, gpointer user_data)
 	g_signal_connect (priv->socket, "disconnected",
 			  G_CALLBACK (socket_disconnected), data->conn);
 
-	soup_connection_set_state (data->conn, SOUP_CONNECTION_IDLE);
+	soup_connection_set_state (data->conn, SOUP_CONNECTION_IN_USE);
 	priv->unused_timeout = time (NULL) + SOUP_CONNECTION_UNUSED_TIMEOUT;
 	start_idle_timer (data->conn);
 
@@ -529,7 +529,7 @@ soup_connection_connect_sync (SoupConnection *conn, GCancellable *cancellable)
 	}
 
 	if (SOUP_STATUS_IS_SUCCESSFUL (status)) {
-		soup_connection_set_state (conn, SOUP_CONNECTION_IDLE);
+		soup_connection_set_state (conn, SOUP_CONNECTION_IN_USE);
 		priv->unused_timeout = time (NULL) + SOUP_CONNECTION_UNUSED_TIMEOUT;
 		start_idle_timer (conn);
 	} else {
diff --git a/libsoup/soup-session-async.c b/libsoup/soup-session-async.c
index 0df8d82..b468f10 100644
--- a/libsoup/soup-session-async.c
+++ b/libsoup/soup-session-async.c
@@ -260,6 +260,7 @@ tunnel_message_completed (SoupMessage *msg, gpointer user_data)
 	g_signal_connect (item->conn, "disconnected",
 			  G_CALLBACK (connection_closed), item->session);
 	soup_connection_set_state (item->conn, SOUP_CONNECTION_IDLE);
+	soup_connection_set_state (item->conn, SOUP_CONNECTION_IN_USE);
 
 	item->related->state = SOUP_MESSAGE_READY;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]