Codebase list evolution-ews / 16b3999
Stale connection used after resume This is a just-in-case change, which avoids re-using connection which had been reported as offline (when the backend/store disconnected). Reported downstream at: https://bugzilla.redhat.com/show_bug.cgi?id=1567572 Milan Crha 6 years ago
5 changed file(s) with 39 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
19121912 g_rec_mutex_lock (&bbews->priv->cnc_lock);
19131913
19141914 if (bbews->priv->cnc) {
1915 e_ews_connection_set_disconnected_flag (bbews->priv->cnc, TRUE);
1916
19151917 g_signal_handlers_disconnect_by_func (bbews->priv->cnc, ebb_ews_server_notification_cb, bbews);
19161918
19171919 if (bbews->priv->subscription_key != 0) {
244244 g_rec_mutex_lock (&cbews->priv->cnc_lock);
245245
246246 if (cbews->priv->cnc) {
247 e_ews_connection_set_disconnected_flag (cbews->priv->cnc, TRUE);
248
247249 g_signal_handlers_disconnect_by_func (cbews->priv->cnc, ecb_ews_server_notification_cb, cbews);
248250
249251 if (cbews->priv->subscription_key != 0) {
13951395 }
13961396
13971397 e_ews_connection_set_password (ews_store->priv->connection, NULL);
1398 e_ews_connection_set_disconnected_flag (ews_store->priv->connection, TRUE);
13981399 g_signal_handlers_disconnect_by_func (ews_store->priv->connection,
13991400 G_CALLBACK (camel_ews_store_password_will_expire_cb), ews_store);
14001401 g_object_unref (ews_store->priv->connection);
107107 GSList *subscribed_folders;
108108
109109 EEwsServerVersion version;
110
111 /* Set to TRUE when this connection had been disconnected and cannot be used anymore */
112 gboolean disconnected_flag;
110113 };
111114
112115 enum {
19041907 g_mutex_lock (&connecting);
19051908
19061909 /* remove the connection from the hash table */
1907 if (loaded_connections_permissions != NULL) {
1908 g_hash_table_remove (
1909 loaded_connections_permissions, priv->hash_key);
1910 if (loaded_connections_permissions != NULL &&
1911 g_hash_table_lookup (loaded_connections_permissions, priv->hash_key) == (gpointer) object) {
1912 g_hash_table_remove (loaded_connections_permissions, priv->hash_key);
19101913 if (g_hash_table_size (loaded_connections_permissions) == 0) {
19111914 g_hash_table_destroy (loaded_connections_permissions);
19121915 loaded_connections_permissions = NULL;
20702073
20712074 cnc->priv->soup_context = g_main_context_new ();
20722075 cnc->priv->soup_loop = g_main_loop_new (cnc->priv->soup_context, FALSE);
2076 cnc->priv->disconnected_flag = FALSE;
20732077
20742078 cnc->priv->subscriptions = g_hash_table_new_full (
20752079 g_direct_hash, g_direct_equal,
23352339 loaded_connections_permissions, hash_key);
23362340 g_free (hash_key);
23372341
2338 if (E_IS_EWS_CONNECTION (cnc)) {
2342 if (E_IS_EWS_CONNECTION (cnc) &&
2343 !e_ews_connection_get_disconnected_flag (cnc)) {
23392344 g_object_ref (cnc);
23402345 g_mutex_unlock (&connecting);
23412346 return cnc;
23692374
23702375 g_hash_table_iter_init (&iter, loaded_connections_permissions);
23712376 while (g_hash_table_iter_next (&iter, NULL, &value)) {
2372 if (value)
2377 if (value && !e_ews_connection_get_disconnected_flag (value))
23732378 connections = g_slist_prepend (connections, g_object_ref (value));
23742379 }
23752380 }
24192424 cnc = g_hash_table_lookup (
24202425 loaded_connections_permissions, hash_key);
24212426
2422 if (E_IS_EWS_CONNECTION (cnc)) {
2427 if (E_IS_EWS_CONNECTION (cnc) &&
2428 !e_ews_connection_get_disconnected_flag (cnc)) {
24232429 g_object_ref (cnc);
24242430
24252431 g_free (hash_key);
27702776 g_return_val_if_fail (E_IS_EWS_CONNECTION (cnc), NULL);
27712777
27722778 return g_object_ref (cnc->priv->soup_session);
2779 }
2780
2781 gboolean
2782 e_ews_connection_get_disconnected_flag (EEwsConnection *cnc)
2783 {
2784 g_return_val_if_fail (E_IS_EWS_CONNECTION (cnc), FALSE);
2785
2786 return cnc->priv->disconnected_flag;
2787 }
2788
2789 void
2790 e_ews_connection_set_disconnected_flag (EEwsConnection *cnc,
2791 gboolean disconnected_flag)
2792 {
2793 g_return_if_fail (E_IS_EWS_CONNECTION (cnc));
2794
2795 cnc->priv->disconnected_flag = disconnected_flag;
27732796 }
27742797
27752798 static xmlDoc *
449449 e_ews_connection_ref_settings (EEwsConnection *cnc);
450450 SoupSession * e_ews_connection_ref_soup_session
451451 (EEwsConnection *cnc);
452 gboolean e_ews_connection_get_disconnected_flag
453 (EEwsConnection *cnc);
454 void e_ews_connection_set_disconnected_flag
455 (EEwsConnection *cnc,
456 gboolean disconnected_flag);
452457 EEwsConnection *e_ews_connection_find (const gchar *uri,
453458 const gchar *username);
454459 GSList * e_ews_connection_list_existing (void); /* EEwsConnection * */