[libsoup] soup-session: don't mark CONNECTING connections IDLE on cancel



commit a36a9e9868f8dd1e6d1339216751c4b3c1b34880
Author: Dan Winship <danw gnome org>
Date:   Thu Mar 1 11:34:37 2012 -0500

    soup-session: don't mark CONNECTING connections IDLE on cancel
    
    When finishing up a queue item, SoupSession was always marking its
    connection IDLE, even if it had previously been CONNECTING. This
    created a race condition where if lots of pending connections were
    cancelled at once, some of them might see connections labelled IDLE
    that didn't actually have a SoupSocket (before those connections got
    asynchronously cleaned up). Fix this by only marking connections IDLE
    if they had previously been IN_USE.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=667245

 libsoup/soup-session.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index f5f7f72..22a02fd 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1976,7 +1976,8 @@ soup_session_unqueue_item (SoupSession          *session,
 	SoupSessionHost *host;
 
 	if (item->conn) {
-		soup_connection_set_state (item->conn, SOUP_CONNECTION_IDLE);
+		if (soup_connection_get_state (item->conn) == SOUP_CONNECTION_IN_USE)
+			soup_connection_set_state (item->conn, SOUP_CONNECTION_IDLE);
 		soup_message_queue_item_set_connection (item, NULL);
 	}
 



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