libsoup r1245 - in trunk: . libsoup



Author: danw
Date: Fri Mar  6 15:19:50 2009
New Revision: 1245
URL: http://svn.gnome.org/viewvc/libsoup?rev=1245&view=rev

Log:
	* libsoup/soup-session-async.c (run_queue): Process messages in
	the CONNECTING iostate before messages in the QUEUED iostate.
	Otherwise, if a bunch of messages are queued all at once, and the
	server doesn't support persistent connections, some messages can
	get stranded in the queue. Fixes #574365 (reported by Xan Lopez)
	and removes a five-year-old FIXME...


Modified:
   trunk/ChangeLog
   trunk/libsoup/soup-session-async.c

Modified: trunk/libsoup/soup-session-async.c
==============================================================================
--- trunk/libsoup/soup-session-async.c	(original)
+++ trunk/libsoup/soup-session-async.c	Fri Mar  6 15:19:50 2009
@@ -25,7 +25,7 @@
  * single-threaded programs.
  **/
 
-static gboolean run_queue (SoupSessionAsync *sa);
+static void run_queue (SoupSessionAsync *sa);
 static void do_idle_run_queue (SoupSession *session);
 
 static void  queue_message   (SoupSession *session, SoupMessage *req,
@@ -233,7 +233,7 @@
 	g_object_unref (session);
 }
 
-static gboolean
+static void
 run_queue (SoupSessionAsync *sa)
 {
 	SoupSession *session = SOUP_SESSION (sa);
@@ -242,11 +242,10 @@
 	SoupProxyResolver *proxy_resolver =
 		soup_session_get_proxy_resolver (session);
 	SoupMessage *msg;
+	SoupMessageIOStatus cur_io_status = SOUP_MESSAGE_IO_STATUS_CONNECTING;
 	SoupConnection *conn;
 	gboolean try_pruning = TRUE, should_prune = FALSE;
-	gboolean started_any = FALSE, is_new;
-
-	/* FIXME: prefer CONNECTING messages */
+	gboolean is_new;
 
  try_again:
 	for (item = soup_message_queue_first (queue);
@@ -254,7 +253,7 @@
 	     item = soup_message_queue_next (queue, item)) {
 		msg = item->msg;
 
-		if (!SOUP_MESSAGE_IS_STARTING (msg) ||
+		if (soup_message_get_io_status (msg) != cur_io_status ||
 		    soup_message_io_in_progress (msg))
 			continue;
 
@@ -282,6 +281,11 @@
 	if (item)
 		soup_message_queue_item_unref (item);
 
+	if (cur_io_status == SOUP_MESSAGE_IO_STATUS_CONNECTING) {
+		cur_io_status = SOUP_MESSAGE_IO_STATUS_QUEUED;
+		goto try_again;
+	}
+
 	if (try_pruning && should_prune) {
 		/* There is at least one message in the queue that
 		 * could be sent if we pruned an idle connection from
@@ -292,8 +296,6 @@
 			goto try_again;
 		}
 	}
-
-	return started_any;
 }
 
 static void



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