aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-store.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-05-15 14:33:01 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-05-15 14:33:01 +0800
commitaabe9bd070a1ff9d7981743311d542457a60b987 (patch)
treeb6cd1b9b6a087cef9ee2f61ca98e59e7bbef08bb /camel/providers/imap/camel-imap-store.c
parentd92240a7413c519e4b001eb54b667257a4f8c9ca (diff)
downloadgsoc2013-evolution-aabe9bd070a1ff9d7981743311d542457a60b987.tar
gsoc2013-evolution-aabe9bd070a1ff9d7981743311d542457a60b987.tar.gz
gsoc2013-evolution-aabe9bd070a1ff9d7981743311d542457a60b987.tar.bz2
gsoc2013-evolution-aabe9bd070a1ff9d7981743311d542457a60b987.tar.lz
gsoc2013-evolution-aabe9bd070a1ff9d7981743311d542457a60b987.tar.xz
gsoc2013-evolution-aabe9bd070a1ff9d7981743311d542457a60b987.tar.zst
gsoc2013-evolution-aabe9bd070a1ff9d7981743311d542457a60b987.zip
removed. (imap_store_refresh_folders): Copy the folders first, then
2002-05-15 Not Zed <NotZed@Ximian.com> * providers/imap/camel-imap-store.c (refresh_folder_info): removed. (imap_store_refresh_folders): Copy the folders first, then refresh them, outside of the cache_lock, which could cause deadlocks because of a workaround for crappo exchange. (imap_disconnect_online): Dont pass an exception to LOGOUT command. The required response 'BYE' always sets an exception when we call LOGOUT. This also interfered with a lot of other processing causing partial failures and messed up offline/online state. * camel-disco-folder.c (disco_prepare_for_offline): Do progress reporting. svn path=/trunk/; revision=16797
Diffstat (limited to 'camel/providers/imap/camel-imap-store.c')
-rw-r--r--camel/providers/imap/camel-imap-store.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index c18c5355cb..6b7c293cca 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -524,30 +524,40 @@ query_auth_types (CamelService *service, CamelException *ex)
return g_list_prepend (types, &camel_imap_password_authtype);
}
-/* call refresh folder directly, bypassing the folder lock */
static void
-refresh_folder_info (gpointer key, gpointer value, gpointer data)
+copy_folder(char *key, CamelFolder *folder, GPtrArray *out)
{
- CamelFolder *folder = CAMEL_FOLDER (value);
-
- CAMEL_IMAP_FOLDER (folder)->need_rescan = TRUE;
- CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(folder))->refresh_info(folder, data);
+ g_ptr_array_add(out, folder);
+ camel_object_ref((CamelObject *)folder);
}
/* This is a little 'hack' to avoid the deadlock conditions that would otherwise
ensue when calling camel_folder_refresh_info from inside a lock */
/* NB: on second thougts this is probably not entirely safe, but it'll do for now */
+/* No, its definetly not safe. So its been changed to copy the folders first */
/* the alternative is to:
make the camel folder->lock recursive (which should probably be done)
or remove it from camel_folder_refresh_info, and use another locking mechanism */
static void
imap_store_refresh_folders (CamelRemoteStore *store, CamelException *ex)
{
+ GPtrArray *folders;
+ int i;
+
+ folders = g_ptr_array_new();
CAMEL_STORE_LOCK(store, cache_lock);
+ g_hash_table_foreach (CAMEL_STORE (store)->folders, (GHFunc)copy_folder, folders);
+ CAMEL_STORE_UNLOCK(store, cache_lock);
- g_hash_table_foreach (CAMEL_STORE (store)->folders, refresh_folder_info, ex);
+ for (i=0;i<folders->len;i++) {
+ CamelFolder *folder = folders->pdata[i];
- CAMEL_STORE_UNLOCK(store, cache_lock);
+ CAMEL_IMAP_FOLDER (folder)->need_rescan = TRUE;
+ if (!camel_exception_is_set(ex))
+ CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(folder))->refresh_info(folder, ex);
+ camel_object_unref((CamelObject *)folder);
+ }
+ g_ptr_array_free(folders, TRUE);
}
static gboolean
@@ -975,7 +985,7 @@ imap_disconnect_online (CamelService *service, gboolean clean, CamelException *e
CamelImapResponse *response;
if (store->connected && clean) {
- response = camel_imap_command (store, NULL, ex, "LOGOUT");
+ response = camel_imap_command (store, NULL, NULL, "LOGOUT");
camel_imap_response_free (store, response);
}
imap_disconnect_offline (service, clean, ex);