[evolution-patches] GW/Exchange backend timeout patch



Hi,

GW and Exchange backends uses libsoup to communicate with the server and
they never timeout.  Attached patch sets a default 30 seconds timeout
when a SoupSession is created.  Timeout property for the SoupSession is
already committed to CVS.  

The default timeout period of 30 seconds can be overridden by an env
variable called "SOUP_SESSION_TIMEOUT" and timeout value is in seconds.

Let me know your review comments please.

Thanks,

V. Varadhan

Index: servers/exchange/lib/e2k-context.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-context.c,v
retrieving revision 1.6
diff -u -p -r1.6 e2k-context.c
--- servers/exchange/lib/e2k-context.c	13 Dec 2005 03:54:28 -0000	1.6
+++ servers/exchange/lib/e2k-context.c	24 Feb 2006 21:58:51 -0000
@@ -110,6 +110,9 @@ struct _E2kContextPrivate {
 #define E2K_CONTEXT_MIN_BATCH_SIZE 25
 #define E2K_CONTEXT_MAX_BATCH_SIZE 100
 
+/* For soup sync session timeout */
+#define E2K_SOUP_SESSION_TIMEOUT 30
+
 #ifdef E2K_DEBUG
 char *e2k_debug;
 int e2k_debug_level;
@@ -357,6 +360,7 @@ e2k_context_set_auth (E2kContext *ctx, c
 		      const char *domain, const char *authmech,
 		      const char *password)
 {
+	guint timeout = E2K_SOUP_SESSION_TIMEOUT;
 
 	g_return_if_fail (E2K_IS_CONTEXT (ctx));
 
@@ -381,8 +385,15 @@ e2k_context_set_auth (E2kContext *ctx, c
 	if (ctx->priv->async_session)
 		g_object_unref (ctx->priv->async_session);
 
+	/* Set a default timeout value of 30 seconds.
+	   FIXME: Make timeout configurable 
+	*/
+	if (g_getenv ("SOUP_SESSION_TIMEOUT"))
+		timeout = atoi (g_getenv ("SOUP_SESSION_TIMEOUT"));
+	
 	ctx->priv->session = soup_session_sync_new_with_options (
 		SOUP_SESSION_USE_NTLM, !authmech || !strcmp (authmech, "NTLM"),
+		SOUP_SESSION_TIMEOUT, timeout,
 		NULL);
 	g_signal_connect (ctx->priv->session, "authenticate",
 			  G_CALLBACK (session_authenticate), ctx);
Index: groupwise/e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.138
diff -u -p -r1.138 e-gw-connection.c
--- servers/groupwise/e-gw-connection.c	23 Jan 2006 11:07:49 -0000	1.138
+++ servers/groupwise/e-gw-connection.c	24 Feb 2006 21:58:51 -0000
@@ -34,6 +34,8 @@
 #include "e-gw-message.h"
 #include "e-gw-filter.h"
 
+/* For soup sync session timeout */
+#define GW_SOUP_SESSION_TIMEOUT 30
 
 static GObjectClass *parent_class = NULL;
 static GHashTable *loaded_connections_permissions = NULL;
@@ -355,13 +357,20 @@ static void
 e_gw_connection_init (EGwConnection *cnc, EGwConnectionClass *klass)
 {
 	EGwConnectionPrivate *priv;
+	guint timeout = GW_SOUP_SESSION_TIMEOUT;
 
 	/* allocate internal structure */
 	priv = g_new0 (EGwConnectionPrivate, 1);
 	cnc->priv = priv;
 
+	/* Set a default timeout value of 30 seconds.
+	   FIXME: Make timeout configurable 
+	*/
+	if (g_getenv ("SOUP_SESSION_TIMEOUT"))
+		timeout = atoi (g_getenv ("SOUP_SESSION_TIMEOUT"));
+	
 	/* create the SoupSession for this connection */
-	priv->soup_session = soup_session_sync_new ();
+	priv->soup_session = soup_session_sync_new_with_options (SOUP_SESSION_TIMEOUT, timeout, NULL);
 	priv->reauth_mutex = g_mutex_new ();
 	priv->categories_by_id = NULL;
 	priv->categories_by_name = NULL;


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