[evolution-data-server] [IMAPx] Wait for IDLE stop up to 10 seconds, then give up
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [IMAPx] Wait for IDLE stop up to 10 seconds, then give up
- Date: Wed, 20 Sep 2017 15:54:30 +0000 (UTC)
commit 3b5832ac4cc2b12a239958ea87d837f86e99ad76
Author: Milan Crha <mcrha redhat com>
Date: Wed Sep 20 17:50:49 2017 +0200
[IMAPx] Wait for IDLE stop up to 10 seconds, then give up
Wait for IDLE stop had been related to time out set on the connection,
which could be very long (as set by IDLE call itself). The server
could be also unreachable due to network change, but this might
not be always caught by the output stream. Having up to 10 seconds
wait will make sure the IDLE stop request will not wait for too long.
src/camel/providers/imapx/camel-imapx-server.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 5a34ca2..fe2358a 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -6485,6 +6485,7 @@ camel_imapx_server_stop_idle_sync (CamelIMAPXServer *is,
{
GCancellable *idle_cancellable;
gulong handler_id = 0;
+ gint64 wait_end_time;
gboolean success = TRUE;
g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
@@ -6557,9 +6558,12 @@ camel_imapx_server_stop_idle_sync (CamelIMAPXServer *is,
g_mutex_lock (&is->priv->idle_lock);
}
+ /* Give server 10 seconds to process the DONE command, if it fails, then give up and reconnect */
+ wait_end_time = g_get_monotonic_time () + 10 * G_TIME_SPAN_SECOND;
+
while (success && is->priv->idle_state != IMAPX_IDLE_STATE_OFF &&
!g_cancellable_is_cancelled (cancellable)) {
- g_cond_wait (&is->priv->idle_cond, &is->priv->idle_lock);
+ success = g_cond_wait_until (&is->priv->idle_cond, &is->priv->idle_lock, wait_end_time);
}
g_mutex_unlock (&is->priv->idle_lock);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]