diff -up evolution-data-server-3.8.5/camel/camel-imapx-store.c.imapx-connect-store evolution-data-server-3.8.5/camel/camel-imapx-store.c
--- evolution-data-server-3.8.5/camel/camel-imapx-store.c.imapx-connect-store 2013-10-14 17:15:00.129077116 +0200
+++ evolution-data-server-3.8.5/camel/camel-imapx-store.c 2013-10-14 17:16:40.005070287 +0200
@@ -1461,12 +1461,6 @@ imapx_store_get_folder_info_sync (CamelS
return fi;
}
- if (!camel_service_connect_sync (
- CAMEL_SERVICE (store), cancellable, error)) {
- g_mutex_unlock (&istore->get_finfo_lock);
- return NULL;
- }
-
if (*top && flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST) {
fi = get_folder_info_offline (store, top, flags, error);
g_mutex_unlock (&istore->get_finfo_lock);
diff -up evolution-data-server-3.8.5/camel/camel-store.c.imapx-connect-store evolution-data-server-3.8.5/camel/camel-store.c
--- evolution-data-server-3.8.5/camel/camel-store.c.imapx-connect-store 2013-07-23 13:57:42.000000000 +0200
+++ evolution-data-server-3.8.5/camel/camel-store.c 2013-10-14 17:17:46.438065744 +0200
@@ -38,6 +38,7 @@
#include "camel-debug.h"
#include "camel-folder.h"
#include "camel-marshal.h"
+#include "camel-offline-store.h"
#include "camel-session.h"
#include "camel-store.h"
#include "camel-store-settings.h"
@@ -276,6 +277,39 @@ store_get_special (CamelStore *store,
return folder;
}
+static gboolean
+store_maybe_connect_sync (CamelStore *store,
+ GCancellable *cancellable,
+ GError **error)
+{
+ CamelService *service;
+ CamelServiceConnectionStatus status;
+ gboolean connect = FALSE;
+ gboolean success = TRUE;
+
+ /* This is meant to recover from dropped connections
+ * when the CamelService is online but disconnected. */
+
+ service = CAMEL_SERVICE (store);
+ status = camel_service_get_connection_status (service);
+ connect = (status != CAMEL_SERVICE_CONNECTED);
+
+ if (CAMEL_IS_OFFLINE_STORE (store)) {
+ CamelOfflineStore *offline_store;
+
+ offline_store = CAMEL_OFFLINE_STORE (store);
+ if (!camel_offline_store_get_online (offline_store))
+ connect = FALSE;
+ }
+
+ if (connect) {
+ success = camel_service_connect_sync (
+ service, cancellable, error);
+ }
+
+ return success;
+}
+
static void
store_finalize (GObject *object)
{
@@ -2099,6 +2133,12 @@ camel_store_get_folder_info_sync (CamelS
cancellable, _("Scanning folders in '%s'"), name);
g_free (name);
+ /* Recover from a dropped connection, unless we're offline. */
+ if (!store_maybe_connect_sync (store, cancellable, error)) {
+ camel_operation_pop_message (cancellable);
+ return NULL;
+ }
+
info = class->get_folder_info_sync (
store, top, flags, cancellable, error);
if (!(flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED))
diff -up evolution-data-server-3.8.5/camel/providers/nntp/camel-nntp-store.c.imapx-connect-store evolution-data-server-3.8.5/camel/providers/nntp/camel-nntp-store.c
--- evolution-data-server-3.8.5/camel/providers/nntp/camel-nntp-store.c.imapx-connect-store 2013-08-03 09:57:21.000000000 +0200
+++ evolution-data-server-3.8.5/camel/providers/nntp/camel-nntp-store.c 2013-10-14 17:15:00.131077116 +0200
@@ -1292,17 +1292,8 @@ nntp_get_folder_info_online (CamelStore
GCancellable *cancellable,
GError **error)
{
- CamelService *service;
- CamelFolderInfo *info = NULL;
-
- service = CAMEL_SERVICE (store);
-
- /* Reconnect if necessary. */
- if (camel_service_connect_sync (service, cancellable, error))
- info = nntp_get_folder_info (
- store, top, flags, TRUE, cancellable, error);
-
- return info;
+ return nntp_get_folder_info (
+ store, top, flags, TRUE, cancellable, error);
}
static CamelFolderInfo *