[evolution-ews] Mark connection disconnected only when disconnecting backend/store
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Mark connection disconnected only when disconnecting backend/store
- Date: Fri, 7 Feb 2020 09:46:24 +0000 (UTC)
commit 365afb2da5bd9e1375d778844fed49e3e1c66913
Author: Milan Crha <mcrha redhat com>
Date: Fri Feb 7 10:41:44 2020 +0100
Mark connection disconnected only when disconnecting backend/store
The connection had been marked as disconnected, thus unusable for any
new attempts to connect to the same server, both when backend/store
had been disconnected and when it had been freed. The later case
is wrong, because there was no problem with the connection, thus
it can be used by other backends (when multiple calendars/books are
configured).
src/addressbook/e-book-backend-ews.c | 10 ++++++----
src/calendar/e-cal-backend-ews.c | 10 ++++++----
src/camel/camel-ews-store.c | 18 +++++++++++-------
3 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index ac4f5b87..7f91dc81 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -2160,14 +2160,16 @@ ebb_ews_server_notification_cb (EBookBackendEws *bbews,
}
static void
-ebb_ews_unset_connection (EBookBackendEws *bbews)
+ebb_ews_unset_connection (EBookBackendEws *bbews,
+ gboolean is_disconnect)
{
g_return_if_fail (E_IS_BOOK_BACKEND_EWS (bbews));
g_rec_mutex_lock (&bbews->priv->cnc_lock);
if (bbews->priv->cnc) {
- e_ews_connection_set_disconnected_flag (bbews->priv->cnc, TRUE);
+ if (is_disconnect)
+ e_ews_connection_set_disconnected_flag (bbews->priv->cnc, TRUE);
g_signal_handlers_disconnect_by_func (bbews->priv->cnc, ebb_ews_server_notification_cb,
bbews);
@@ -3335,7 +3337,7 @@ ebb_ews_disconnect_sync (EBookMetaBackend *meta_backend,
bbews = E_BOOK_BACKEND_EWS (meta_backend);
- ebb_ews_unset_connection (bbews);
+ ebb_ews_unset_connection (bbews, TRUE);
return TRUE;
}
@@ -4034,7 +4036,7 @@ e_book_backend_ews_dispose (GObject *object)
{
EBookBackendEws *bbews = E_BOOK_BACKEND_EWS (object);
- ebb_ews_unset_connection (bbews);
+ ebb_ews_unset_connection (bbews, FALSE);
/* Chain up to parent's method. */
G_OBJECT_CLASS (e_book_backend_ews_parent_class)->dispose (object);
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index c7d695a3..6869f44b 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -277,14 +277,16 @@ ecb_ews_server_notification_cb (ECalBackendEws *cbews,
}
static void
-ecb_ews_unset_connection (ECalBackendEws *cbews)
+ecb_ews_unset_connection (ECalBackendEws *cbews,
+ gboolean is_disconnect)
{
g_return_if_fail (E_IS_CAL_BACKEND_EWS (cbews));
g_rec_mutex_lock (&cbews->priv->cnc_lock);
if (cbews->priv->cnc) {
- e_ews_connection_set_disconnected_flag (cbews->priv->cnc, TRUE);
+ if (is_disconnect)
+ e_ews_connection_set_disconnected_flag (cbews->priv->cnc, TRUE);
g_signal_handlers_disconnect_by_func (cbews->priv->cnc, ecb_ews_server_notification_cb,
cbews);
@@ -1670,7 +1672,7 @@ ecb_ews_disconnect_sync (ECalMetaBackend *meta_backend,
cbews = E_CAL_BACKEND_EWS (meta_backend);
- ecb_ews_unset_connection (cbews);
+ ecb_ews_unset_connection (cbews, TRUE);
return TRUE;
}
@@ -4253,7 +4255,7 @@ ecb_ews_dispose (GObject *object)
{
ECalBackendEws *cbews = E_CAL_BACKEND_EWS (object);
- ecb_ews_unset_connection (cbews);
+ ecb_ews_unset_connection (cbews, FALSE);
/* Chain up to parent's method. */
G_OBJECT_CLASS (e_cal_backend_ews_parent_class)->dispose (object);
diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c
index 98fdfab8..7dd9e085 100644
--- a/src/camel/camel-ews-store.c
+++ b/src/camel/camel-ews-store.c
@@ -1597,7 +1597,8 @@ stop_pending_updates (CamelEwsStore *ews_store)
}
static void
-ews_store_unset_connection_locked (CamelEwsStore *ews_store)
+ews_store_unset_connection_locked (CamelEwsStore *ews_store,
+ gboolean is_disconnect)
{
g_return_if_fail (CAMEL_IS_EWS_STORE (ews_store));
@@ -1632,8 +1633,11 @@ ews_store_unset_connection_locked (CamelEwsStore *ews_store)
ews_store->priv->listen_notifications = FALSE;
}
- e_ews_connection_set_password (ews_store->priv->connection, NULL);
- e_ews_connection_set_disconnected_flag (ews_store->priv->connection, TRUE);
+ if (is_disconnect) {
+ e_ews_connection_set_password (ews_store->priv->connection, NULL);
+ e_ews_connection_set_disconnected_flag (ews_store->priv->connection, TRUE);
+ }
+
g_signal_handlers_disconnect_by_func (ews_store->priv->connection,
G_CALLBACK (camel_ews_store_password_will_expire_cb), ews_store);
g_object_unref (ews_store->priv->connection);
@@ -1651,7 +1655,7 @@ ews_disconnect_sync (CamelService *service,
CamelServiceClass *service_class;
g_mutex_lock (&ews_store->priv->connection_lock);
- ews_store_unset_connection_locked (ews_store);
+ ews_store_unset_connection_locked (ews_store, TRUE);
g_mutex_unlock (&ews_store->priv->connection_lock);
service_class = CAMEL_SERVICE_CLASS (camel_ews_store_parent_class);
@@ -2154,7 +2158,7 @@ ews_authenticate_sync (CamelService *service,
GSList *foreign_fids, *ff;
g_mutex_lock (&ews_store->priv->connection_lock);
- ews_store_unset_connection_locked (ews_store);
+ ews_store_unset_connection_locked (ews_store, FALSE);
ews_store->priv->connection = g_object_ref (connection);
g_signal_connect (ews_store->priv->connection, "password-will-expire",
G_CALLBACK (camel_ews_store_password_will_expire_cb), ews_store);
@@ -2179,7 +2183,7 @@ ews_authenticate_sync (CamelService *service,
g_slist_free_full (foreign_fids, g_free);
} else {
g_mutex_lock (&ews_store->priv->connection_lock);
- ews_store_unset_connection_locked (ews_store);
+ ews_store_unset_connection_locked (ews_store, FALSE);
g_mutex_unlock (&ews_store->priv->connection_lock);
g_free (new_sync_state);
@@ -3975,7 +3979,7 @@ ews_store_dispose (GObject *object)
}
g_mutex_lock (&ews_store->priv->connection_lock);
- ews_store_unset_connection_locked (ews_store);
+ ews_store_unset_connection_locked (ews_store, FALSE);
g_mutex_unlock (&ews_store->priv->connection_lock);
g_slist_free_full (ews_store->priv->update_folder_names, g_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]