[evolution-patches] soup connection timeout patch



More soup fun... mr-nutty has recently acquired the inexplicable
behavior of not timing out stale connections until after you start
writing to them, thus resulting in connector getting "can't connect"
errors from soup when you try to do something after being idle for a
while. This fixes that by assuming that an error on a previously good
connection is a retryable condition. (If the error was caused by
something like the network falling over, then the retry will also fail,
and that time it will actually return the error, because
soup_connection_is_new() will return true at that point.)


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libsoup/ChangeLog,v
retrieving revision 1.298
diff -u -r1.298 ChangeLog
--- ChangeLog	24 Apr 2003 17:59:01 -0000	1.298
+++ ChangeLog	25 Apr 2003 15:06:32 -0000
@@ -1,3 +1,10 @@
+2003-04-25  Dan Winship  <danw ximian com>
+
+	* libsoup/soup-queue.c (soup_queue_error_cb): if an old connection
+	suddenly gets an io error while reading or writing, assume it's a
+	timeout or something, close the connection, and requeue the
+	message.
+
 2003-04-23  Dan Winship  <danw ximian com>
 
 	* libsoup/soup-message.c (soup_message_cleanup): Don't set up the
Index: libsoup/soup-queue.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-queue.c,v
retrieving revision 1.79
diff -u -r1.79 soup-queue.c
--- libsoup/soup-queue.c	11 Apr 2003 17:02:29 -0000	1.79
+++ libsoup/soup-queue.c	25 Apr 2003 15:06:33 -0000
@@ -90,11 +90,16 @@
 					req->priv->retries++;
 					soup_message_requeue (req);
 				}
-			} else {
+			} else if (soup_connection_is_new (req->connection)) {
 				soup_message_set_error (
 					req,
 					SOUP_ERROR_CANT_CONNECT);
 				soup_message_issue_callback (req);
+			} else {
+				/* Must have timed out. Try a new connection */
+				soup_connection_release (req->connection);
+				req->connection = NULL;
+				soup_message_requeue (req);
 			}
 		} else {
 			soup_message_set_error (req, SOUP_ERROR_IO);


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