[evolution-patches] more imap startup fixes
- From: Not Zed <notzed ximian com>
- To: asdf <evolution-patches lists ximian com>
- Subject: [evolution-patches] more imap startup fixes
- Date: Tue, 09 Aug 2005 14:31:20 +0800
another patch to re-arrange the locking and remove some unecessary work.
now it doesn't force a re-scan of all folders at startup or re-connect,
etc. this is done elsewhere.
and the locking in get_folder_info locked even if it just needed to get
the info locally, so this only locks if it must.
there are still some updating bugs, but this speeds up the startup
enough to make it worth it
--
adfa(evolution-2.4:20087): gtkhtml-WARNING **: cannot find icon:
'stock_insert-url' in gnome
Index: camel/providers/imap/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/ChangeLog,v
retrieving revision 1.25
diff -u -p -r1.25 ChangeLog
--- camel/providers/imap/ChangeLog 9 Aug 2005 05:42:03 -0000 1.25
+++ camel/providers/imap/ChangeLog 9 Aug 2005 06:30:58 -0000
@@ -1,3 +1,10 @@
+2005-08-09 Not Zed <NotZed Ximian com>
+
+ * camel-imap-store.c (get_folder_info_online): re-arrange locking
+ so we only run if we need to.
+ (imap_connect_online, imap_connect_offline): dont refresh-folders
+ on startup, that is handled if we need to/can in get_folder_info.
+
2005-04-17 Changwoo Ryu <cwryu debian org>
** See bug #300891
Index: camel/providers/imap/camel-imap-store.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-store.c,v
retrieving revision 1.326
diff -u -p -r1.326 camel-imap-store.c
--- camel/providers/imap/camel-imap-store.c 3 Aug 2005 07:56:27 -0000 1.326
+++ camel/providers/imap/camel-imap-store.c 9 Aug 2005 06:30:59 -0000
@@ -1510,8 +1510,6 @@ imap_connect_online (CamelService *servi
if (camel_exception_is_set (ex))
camel_service_disconnect (service, TRUE, NULL);
- else if (camel_disco_diary_empty (disco_store->diary))
- imap_store_refresh_folders (store, ex);
return !camel_exception_is_set (ex);
}
@@ -1529,8 +1527,6 @@ imap_connect_offline (CamelService *serv
if (!disco_store->diary)
return FALSE;
- imap_store_refresh_folders (store, ex);
-
store->connected = !camel_exception_is_set (ex);
return store->connected;
}
@@ -2655,8 +2651,6 @@ get_folder_info_online (CamelStore *stor
if (top == NULL)
top = "";
- CAMEL_SERVICE_LOCK(store, connect_lock);
-
if (camel_debug("imap:folder_info"))
printf("get folder info online\n");
@@ -2667,24 +2661,30 @@ get_folder_info_online (CamelStore *stor
now = time(0);
ref = now > imap_store->refresh_stamp+60*60*1;
- if (ref)
- imap_store->refresh_stamp = now;
-
if (ref) {
- struct _refresh_msg *m;
-
- m = camel_session_thread_msg_new(((CamelService *)store)->session, &refresh_ops, sizeof(*m));
- m->store = store;
- camel_object_ref(store);
- camel_exception_init(&m->ex);
- camel_session_thread_queue(((CamelService *)store)->session, &m->msg, 0);
+ CAMEL_SERVICE_LOCK(store, connect_lock);
+ ref = now > imap_store->refresh_stamp+60*60*1;
+ if (ref) {
+ struct _refresh_msg *m;
+
+ imap_store->refresh_stamp = now;
+
+ m = camel_session_thread_msg_new(((CamelService *)store)->session, &refresh_ops, sizeof(*m));
+ m->store = store;
+ camel_object_ref(store);
+ camel_exception_init(&m->ex);
+ camel_session_thread_queue(((CamelService *)store)->session, &m->msg, 0);
+ }
+ CAMEL_SERVICE_UNLOCK(store, connect_lock);
}
} else {
char *pattern;
int i;
+ CAMEL_SERVICE_LOCK(store, connect_lock);
+
if (!camel_imap_store_connected((CamelImapStore *)store, ex))
- goto done;
+ goto fail;
if (top[0] == 0) {
if (imap_store->namespace && imap_store->namespace[0]) {
@@ -2715,7 +2715,7 @@ get_folder_info_online (CamelStore *stor
get_folders_sync(imap_store, pattern, ex);
if (camel_exception_is_set(ex))
- goto done;
+ goto fail;
if (pattern[0] != '*' && imap_store->dir_sep) {
pattern[i] = imap_store->dir_sep;
pattern[i+1] = (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE)?'*':'%';
@@ -2723,13 +2723,15 @@ get_folder_info_online (CamelStore *stor
get_folders_sync(imap_store, pattern, ex);
}
camel_store_summary_save((CamelStoreSummary *)imap_store->summary);
+ CAMEL_SERVICE_UNLOCK(store, connect_lock);
}
tree = get_folder_info_offline(store, top, flags, ex);
-done:
- CAMEL_SERVICE_UNLOCK(store, connect_lock);
-
return tree;
+
+fail:
+ CAMEL_SERVICE_UNLOCK(store, connect_lock);
+ return NULL;
}
static CamelFolderInfo *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]