[evolution-data-server] [IMAPx] Cleanup busy/idle hashes on connect/disconnect
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [IMAPx] Cleanup busy/idle hashes on connect/disconnect
- Date: Tue, 5 Apr 2016 11:43:08 +0000 (UTC)
commit efdfa4d87c411156a6de799486a4404657a13520
Author: Milan Crha <mcrha redhat com>
Date: Tue Apr 5 13:41:30 2016 +0200
[IMAPx] Cleanup busy/idle hashes on connect/disconnect
A reconnect could block IDLE from being run due to the idle hash
table containing mailbox which wasn't running IDLE any more.
camel/providers/imapx/camel-imapx-conn-manager.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-conn-manager.c
b/camel/providers/imapx/camel-imapx-conn-manager.c
index fbc2188..f2ae387 100644
--- a/camel/providers/imapx/camel-imapx-conn-manager.c
+++ b/camel/providers/imapx/camel-imapx-conn-manager.c
@@ -447,6 +447,19 @@ imapx_conn_manager_is_mailbox_hash (CamelIMAPXConnManager *conn_man,
}
static void
+imapx_conn_manager_clear_mailboxes_hashes (CamelIMAPXConnManager *conn_man)
+{
+ g_return_if_fail (CAMEL_IS_IMAPX_CONN_MANAGER (conn_man));
+
+ g_mutex_lock (&conn_man->priv->busy_mailboxes_lock);
+
+ g_hash_table_remove_all (conn_man->priv->busy_mailboxes);
+ g_hash_table_remove_all (conn_man->priv->idle_mailboxes);
+
+ g_mutex_unlock (&conn_man->priv->busy_mailboxes_lock);
+}
+
+static void
imapx_conn_manager_inc_mailbox_busy (CamelIMAPXConnManager *conn_man,
CamelIMAPXMailbox *mailbox)
{
@@ -1003,6 +1016,8 @@ camel_imapx_conn_manager_connect_sync (CamelIMAPXConnManager *conn_man,
}
CON_READ_UNLOCK (conn_man);
+ imapx_conn_manager_clear_mailboxes_hashes (conn_man);
+
cinfo = camel_imapx_conn_manager_ref_connection (conn_man, NULL, cancellable, error);
if (cinfo) {
imapx_conn_manager_unmark_busy (conn_man, cinfo);
@@ -1053,6 +1068,8 @@ camel_imapx_conn_manager_disconnect_sync (CamelIMAPXConnManager *conn_man,
g_list_free (connections);
+ imapx_conn_manager_clear_mailboxes_hashes (conn_man);
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]