Patch: fix concurrent accesses to the imap summary
- From: "Martin Bonnin" <martinbonnin gmail com>
- To: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Patch: fix concurrent accesses to the imap summary
- Date: Thu, 20 Nov 2008 11:50:30 +0100
Hello all,
Patch is attached. This looks like quite a low-level problem and
I'm not sure this patch is enough for all cases. But at least it fixes
one instance of the problem (removing on the server then fetching a
new message).
Changelog:
For IMAP, we open 2 sessions: one for standard operations, the other
for fetching messages. This makes concurrent accesses to the folder summary
therefore corrupting it.
This happens e.g when you delete a message and fetch a new one afterwards.
This patch adds the "dont_touch_summary" parameter to prevent the
GetMsg session to
mess up too much.
--
Martin
Index: libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c (révision 3817)
+++ libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c (copie de travail)
@@ -756,6 +756,8 @@
imap_store->parameters |= IMAP_PARAM_FILTER_JUNK;
if (camel_url_get_param (url, "filter_junk_inbox"))
imap_store->parameters |= IMAP_PARAM_FILTER_JUNK_INBOX;
+ if (camel_url_get_param (url, "dont_touch_summary"))
+ imap_store->parameters |= IMAP_PARAM_DONT_TOUCH_SUMMARY;
/* setup journal*/
path = g_strdup_printf ("%s/journal", imap_store->storage_path);
Index: libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.h
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.h (révision 3817)
+++ libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.h (copie de travail)
@@ -133,6 +133,7 @@
#define IMAP_PARAM_FILTER_JUNK (1 << 3)
#define IMAP_PARAM_FILTER_JUNK_INBOX (1 << 4)
#define IMAP_PARAM_SUBSCRIPTIONS (1 << 5)
+#define IMAP_PARAM_DONT_TOUCH_SUMMARY (1 << 6)
struct _CamelImapStore {
CamelDiscoStore parent_object;
Index: libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c (révision 3817)
+++ libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c (copie de travail)
@@ -4694,6 +4694,9 @@
store = CAMEL_IMAP_STORE (camel_object_new (CAMEL_IMAP_STORE_TYPE));
imap_debug ("Get-Message service created\n");
+
+ camel_url_set_param(CAMEL_SERVICE (folder->parent_store)->url, "dont_touch_summary", "yes");
+
camel_service_construct (CAMEL_SERVICE (store),
camel_service_get_session (CAMEL_SERVICE (folder->parent_store)),
camel_service_get_provider (CAMEL_SERVICE (folder->parent_store)),
Index: libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c (révision 3817)
+++ libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c (copie de travail)
@@ -1067,8 +1067,10 @@
if (response->folder && !fetching_message) {
if (exists > 0 || expunged) {
/* Update the summary */
- camel_imap_folder_changed (response->folder,
+ if (!(store->parameters & IMAP_PARAM_DONT_TOUCH_SUMMARY)){
+ camel_imap_folder_changed (response->folder,
exists, expunged, NULL);
+ }
}
}
Index: ChangeLog
===================================================================
--- ChangeLog (révision 3817)
+++ ChangeLog (copie de travail)
@@ -1,3 +1,13 @@
+2008-11-20 Martin Bonnin <martinbonnin gmail com>
+
+ * libtinymail-camel/camel-lite/camel/providers/imap:
+ For IMAP, we open 2 sessions: one for standard operations, the other
+ for fetching messages. This makes concurrent accesses to the folder summary
+ therefore corrupting it.
+ This happens e.g when you delete a message and fetch a new one afterwards.
+ This patch adds the "dont_touch_summary" parameter to prevent the GetMsg session to
+ mess up too much.
+
2008-11-19 Martin Bonnin <martinbonnin gmail com>
* libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]