aboutsummaryrefslogtreecommitdiffstats
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
parentd92240a7413c519e4b001eb54b667257a4f8c9ca (diff)
downloadgsoc2013-evolution-aabe9bd070a1ff9d7981743311d542457a60b987.tar.gz
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
-rw-r--r--camel/ChangeLog15
-rw-r--r--camel/camel-disco-folder.c14
-rw-r--r--camel/providers/imap/camel-imap-store.c28
3 files changed, 47 insertions, 10 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index b8253c1448..897085bba2 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
2002-05-14 Jeffrey Stedfast <fejj@ximian.com>
Fixes bug #24136.
diff --git a/camel/camel-disco-folder.c b/camel/camel-disco-folder.c
index 965ceb0864..3d3d9212bd 100644
--- a/camel/camel-disco-folder.c
+++ b/camel/camel-disco-folder.c
@@ -275,21 +275,33 @@ disco_prepare_for_offline (CamelDiscoFolder *disco_folder,
GPtrArray *uids;
int i;
+ camel_operation_start(NULL, _("Preparing folder '%s' for offline"), folder->full_name);
+
if (expression)
uids = camel_folder_search_by_expression (folder, expression, ex);
else
uids = camel_folder_get_uids (folder);
- if (!uids)
+
+ if (!uids) {
+ camel_operation_end(NULL);
return;
+ }
+
for (i = 0; i < uids->len; i++) {
+ int pc = i * 100 / uids->len;
+
camel_disco_folder_cache_message (disco_folder, uids->pdata[i], ex);
+ camel_operation_progress(NULL, pc);
if (camel_exception_is_set (ex))
break;
}
+
if (expression)
camel_folder_search_free (folder, uids);
else
camel_folder_free_uids (folder, uids);
+
+ camel_operation_end(NULL);
}
/**
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);