[evolution-ews/gnome-3-4] Preset default connection timeout to two minutes (tweak with EWS_CONN_TIMEOUT)
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/gnome-3-4] Preset default connection timeout to two minutes (tweak with EWS_CONN_TIMEOUT)
- Date: Wed, 11 Jul 2012 09:06:23 +0000 (UTC)
commit 2d693ca09c921332c9a3887724a1d6f3f25af184
Author: Milan Crha <mcrha redhat com>
Date: Wed Jul 11 11:03:40 2012 +0200
Preset default connection timeout to two minutes (tweak with EWS_CONN_TIMEOUT)
It seems that not setting timeout for libsoup means no timeout at all,
which is not always good to have, thus preset some connection timeout.
src/server/e-ews-connection.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 2298401..c1ffa5c 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1057,6 +1057,7 @@ static void
e_ews_connection_init (EEwsConnection *cnc)
{
EEwsConnectionPrivate *priv;
+ gint timeout;
/* allocate internal structure */
priv = g_new0 (EEwsConnectionPrivate, 1);
@@ -1067,11 +1068,21 @@ e_ews_connection_init (EEwsConnection *cnc)
priv->soup_thread = g_thread_create (e_ews_soup_thread, cnc, TRUE, NULL);
+ /* default timeout is two minutes */
+ timeout = 120;
+ if (g_getenv ("EWS_CONN_TIMEOUT")) {
+ timeout = atoi (g_getenv ("EWS_CONN_TIMEOUT"));
+ if (timeout <= 0)
+ timeout = 120;
+ }
+
/* create the SoupSession for this connection */
priv->soup_session = soup_session_async_new_with_options (SOUP_SESSION_USE_NTLM, TRUE,
- SOUP_SESSION_ASYNC_CONTEXT, priv->soup_context, NULL);
+ SOUP_SESSION_ASYNC_CONTEXT, priv->soup_context,
+ SOUP_SESSION_TIMEOUT, timeout,
+ NULL);
- if (getenv("EWS_DEBUG") && (atoi (g_getenv ("EWS_DEBUG")) >= 2)) {
+ if (g_getenv("EWS_DEBUG") && (atoi (g_getenv ("EWS_DEBUG")) >= 2)) {
SoupLogger *logger;
logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
soup_session_add_feature (priv->soup_session, SOUP_SESSION_FEATURE (logger));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]