Remove camel_service_lock/unlock().
authorMatthew Barnes <mbarnes@redhat.com>
Sat, 19 May 2012 16:02:05 +0000 (12:02 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Sat, 19 May 2012 17:43:29 +0000 (13:43 -0400)
This has been the cause of many deadlocks, and is no longer needed with
CamelService's new asynchronous connect/disconnect API.

camel/camel-imapx-conn-manager.c
camel/camel-imapx-store.c
camel/camel-service.c
camel/camel-service.h
camel/providers/imap/camel-imap-folder.c
camel/providers/imap/camel-imap-store.c
camel/providers/nntp/camel-nntp-folder.c
camel/providers/nntp/camel-nntp-store.c
docs/reference/camel/camel-sections.txt

index 89d1af5..ccc93ac 100644 (file)
@@ -570,21 +570,16 @@ imapx_create_new_connection_unlocked (CamelIMAPXConnManager *con_man,
        CamelIMAPXServer *is = NULL;
        CamelIMAPXStore *imapx_store;
        CamelStore *store = con_man->priv->store;
-       CamelService *service;
        ConnectionInfo *cinfo = NULL;
        gboolean success;
 
        /* Caller must be holding CON_WRITE_LOCK. */
 
-       service = CAMEL_SERVICE (store);
-
        imapx_store = CAMEL_IMAPX_STORE (store);
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        /* Check if we got cancelled while we were waiting. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error))
-               goto exit;
+               return NULL;
 
        is = camel_imapx_server_new (store);
 
@@ -610,8 +605,7 @@ imapx_create_new_connection_unlocked (CamelIMAPXConnManager *con_man,
 
        if (!success) {
                g_object_unref (is);
-               is = NULL;
-               goto exit;
+               return NULL;
        }
 
        g_signal_connect (
@@ -632,9 +626,6 @@ imapx_create_new_connection_unlocked (CamelIMAPXConnManager *con_man,
 
        c(is->tagprefix, "Created new connection for %s and total connections %d \n", folder_name, g_list_length (con_man->priv->connections));
 
-exit:
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return is;
 }
 
index 8621f7b..da71fda 100644 (file)
@@ -169,15 +169,8 @@ camel_imapx_store_get_server (CamelIMAPXStore *istore,
                               GCancellable *cancellable,
                               GError **error)
 {
-       CamelIMAPXServer *server = NULL;
-
-       camel_service_lock (CAMEL_SERVICE (istore), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       server = camel_imapx_conn_manager_get_connection (istore->con_man, folder_name, cancellable, error);
-
-       camel_service_unlock (CAMEL_SERVICE (istore), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return server;
+       return camel_imapx_conn_manager_get_connection (
+               istore->con_man, folder_name, cancellable, error);
 }
 
 void
@@ -187,7 +180,8 @@ camel_imapx_store_op_done (CamelIMAPXStore *istore,
 {
        g_return_if_fail (server != NULL);
 
-       camel_imapx_conn_manager_update_con_info (istore->con_man, server, folder_name);
+       camel_imapx_conn_manager_update_con_info (
+               istore->con_man, server, folder_name);
 }
 
 static gboolean
@@ -220,13 +214,8 @@ imapx_disconnect_sync (CamelService *service,
        if (!service_class->disconnect_sync (service, clean, cancellable, error))
                return FALSE;
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (istore->con_man) {
+       if (istore->con_man != NULL)
                camel_imapx_conn_manager_close_connections (istore->con_man);
-       }
-
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        return TRUE;
 }
@@ -285,14 +274,11 @@ imapx_query_auth_types_sync (CamelService *service,
                return NULL;
        }
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        server = camel_imapx_server_new (CAMEL_STORE (istore));
 
        connected = server->stream != NULL;
        if (!connected)
                connected = imapx_connect_to_server (server, cancellable, error);
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
        if (!connected)
                return NULL;
 
index f197186..17d481a 100644 (file)
@@ -66,9 +66,6 @@ struct _CamelServicePrivate {
        gchar *uid;
        gchar *password;
 
-       GStaticRecMutex connect_lock;   /* for locking connection operations */
-       GStaticMutex connect_op_lock;   /* for locking the connection_op */
-
        GMutex *connection_lock;
        ConnectionOp *connection_op;
        CamelServiceConnectionStatus status;
@@ -674,9 +671,6 @@ service_finalize (GObject *object)
        g_free (priv->uid);
        g_free (priv->password);
 
-       g_static_rec_mutex_free (&priv->connect_lock);
-       g_static_mutex_free (&priv->connect_op_lock);
-
        /* There should be no outstanding connection operations. */
        g_warn_if_fail (priv->connection_op == NULL);
        g_mutex_free (priv->connection_lock);
@@ -1139,9 +1133,6 @@ camel_service_init (CamelService *service)
 {
        service->priv = CAMEL_SERVICE_GET_PRIVATE (service);
 
-       g_static_rec_mutex_init (&service->priv->connect_lock);
-       g_static_mutex_init (&service->priv->connect_op_lock);
-
        service->priv->connection_lock = g_mutex_new ();
        service->priv->status = CAMEL_SERVICE_DISCONNECTED;
 }
@@ -1549,60 +1540,6 @@ camel_service_get_uid (CamelService *service)
 }
 
 /**
- * camel_service_lock:
- * @service: a #CamelService
- * @lock: lock type to lock
- *
- * Locks @service's @lock. Unlock it with camel_service_unlock().
- *
- * Since: 2.32
- **/
-void
-camel_service_lock (CamelService *service,
-                    CamelServiceLock lock)
-{
-       g_return_if_fail (CAMEL_IS_SERVICE (service));
-
-       switch (lock) {
-               case CAMEL_SERVICE_REC_CONNECT_LOCK:
-                       g_static_rec_mutex_lock (&service->priv->connect_lock);
-                       break;
-               case CAMEL_SERVICE_CONNECT_OP_LOCK:
-                       g_static_mutex_lock (&service->priv->connect_op_lock);
-                       break;
-               default:
-                       g_return_if_reached ();
-       }
-}
-
-/**
- * camel_service_unlock:
- * @service: a #CamelService
- * @lock: lock type to unlock
- *
- * Unlocks @service's @lock, previously locked with camel_service_lock().
- *
- * Since: 2.32
- **/
-void
-camel_service_unlock (CamelService *service,
-                      CamelServiceLock lock)
-{
-       g_return_if_fail (CAMEL_IS_SERVICE (service));
-
-       switch (lock) {
-               case CAMEL_SERVICE_REC_CONNECT_LOCK:
-                       g_static_rec_mutex_unlock (&service->priv->connect_lock);
-                       break;
-               case CAMEL_SERVICE_CONNECT_OP_LOCK:
-                       g_static_mutex_unlock (&service->priv->connect_op_lock);
-                       break;
-               default:
-                       g_return_if_reached ();
-       }
-}
-
-/**
  * camel_service_connect_sync:
  * @service: a #CamelService
  * @cancellable: optional #GCancellable object, or %NULL
@@ -2111,20 +2048,13 @@ camel_service_query_auth_types_sync (CamelService *service,
                                      GError **error)
 {
        CamelServiceClass *class;
-       GList *list;
 
        g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
 
        class = CAMEL_SERVICE_GET_CLASS (service);
        g_return_val_if_fail (class->query_auth_types_sync != NULL, NULL);
 
-       /* Note that we get the connect lock here, which means the
-        * callee must not call the connect functions itself. */
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-       list = class->query_auth_types_sync (service, cancellable, error);
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return list;
+       return class->query_auth_types_sync (service, cancellable, error);
 }
 
 /**
index 8f9d146..3d17795 100644 (file)
@@ -84,16 +84,6 @@ typedef enum {
        CAMEL_SERVICE_ERROR_NOT_CONNECTED
 } CamelServiceError;
 
-/**
- * CamelServiceLock:
- *
- * Since: 2.32
- **/
-typedef enum {
-       CAMEL_SERVICE_REC_CONNECT_LOCK,
-       CAMEL_SERVICE_CONNECT_OP_LOCK
-} CamelServiceLock;
-
 struct _CamelService {
        CamelObject parent;
        CamelServicePrivate *priv;
@@ -199,10 +189,6 @@ CamelSettings *    camel_service_get_settings      (CamelService *service);
 void           camel_service_set_settings      (CamelService *service,
                                                 CamelSettings *settings);
 const gchar *  camel_service_get_uid           (CamelService *service);
-void           camel_service_lock              (CamelService *service,
-                                                CamelServiceLock lock);
-void           camel_service_unlock            (CamelService *service,
-                                                CamelServiceLock lock);
 
 gboolean       camel_service_connect_sync      (CamelService *service,
                                                 GCancellable *cancellable,
index 060f0c5..ee3f5e6 100644 (file)
@@ -901,7 +901,6 @@ imap_refresh_info_sync (CamelFolder *folder,
         * Also, if this is the INBOX, some servers (cryus) wont tell
         * us with a NOOP of new messages, so force a reselect which
         * should do it.  */
-       camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        if (camel_application_is_exiting  || !camel_imap_store_connected (imap_store, &local_error))
                goto done;
@@ -983,9 +982,8 @@ imap_refresh_info_sync (CamelFolder *folder,
                                folder, camel_folder_summary_count (
                                folder->summary), cancellable, &local_error);
        }
-done:
-       camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
+done:
        camel_folder_summary_save_to_db (folder->summary, NULL);
        camel_store_summary_save ((CamelStoreSummary *)((CamelImapStore *) parent_store)->summary);
 
@@ -1178,7 +1176,6 @@ imap_rescan (CamelFolder *folder,
 
        if (summary_got == 0 && summary_len == 0) {
                camel_operation_pop_message (cancellable);
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                g_free (new);
                g_free (resp);
 
@@ -1196,9 +1193,6 @@ imap_rescan (CamelFolder *folder,
                g_free (new);
                g_free (resp);
 
-               if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
-                       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
                camel_folder_summary_free_array (known_uids);
                return TRUE;
        }
@@ -1615,7 +1609,7 @@ imap_synchronize_sync (CamelFolder *folder,
        CamelImapStore *store;
        CamelImapMessageInfo *info;
        CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
-       gboolean success, is_gmail;
+       gboolean is_gmail;
        CamelFolder *real_junk = NULL;
        CamelFolder *real_trash = NULL;
        gchar *folder_path;
@@ -1640,8 +1634,6 @@ imap_synchronize_sync (CamelFolder *folder,
                return imap_sync_offline (folder, error);
        }
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        /* write local changes first */
        replay_offline_journal (store, imap_folder, cancellable, NULL);
 
@@ -1810,9 +1802,6 @@ imap_synchronize_sync (CamelFolder *folder,
                }
                g_ptr_array_free (matches, TRUE);
 
-               /* We unlock here so that other threads can have a chance to grab the connect_lock */
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
                /* check for an exception */
                if (local_error != NULL) {
                        g_propagate_error (error, local_error);
@@ -1830,9 +1819,6 @@ imap_synchronize_sync (CamelFolder *folder,
                                g_object_unref (real_junk);
                        return FALSE;
                }
-
-               /* Re-lock the connect_lock */
-               camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
        }
 
        if (local_error == NULL)
@@ -1867,11 +1853,7 @@ imap_synchronize_sync (CamelFolder *folder,
        g_ptr_array_free (summary, TRUE);
 
        /* Save the summary */
-       success = imap_sync_offline (folder, error);
-
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return success;
+       return imap_sync_offline (folder, error);
 }
 
 static gint
@@ -1955,14 +1937,9 @@ imap_expunge_uids_online (CamelFolder *folder,
        store = CAMEL_IMAP_STORE (parent_store);
        full_expunge = (store->capabilities & IMAP_CAPABILITY_UIDPLUS) == 0;
 
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if ((store->capabilities & IMAP_CAPABILITY_UIDPLUS) == 0) {
                if (!CAMEL_FOLDER_GET_CLASS (folder)->synchronize_sync (
                        folder, 0, cancellable, error)) {
-                       camel_service_unlock (
-                               CAMEL_SERVICE (store),
-                               CAMEL_SERVICE_REC_CONNECT_LOCK);
                        return FALSE;
                }
        }
@@ -1977,7 +1954,6 @@ imap_expunge_uids_online (CamelFolder *folder,
                if (response)
                        camel_imap_response_free (store, response);
                else {
-                       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                        g_free (set);
                        return FALSE;
                }
@@ -2010,8 +1986,6 @@ imap_expunge_uids_online (CamelFolder *folder,
                g_free (set);
        }
 
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        changes = camel_folder_change_info_new ();
        for (i = 0; i < uids->len; i++) {
                camel_folder_summary_remove_uid (folder->summary, uids->pdata[i]);
@@ -2115,26 +2089,17 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
         * marked un-deleted.
         */
 
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if (!CAMEL_FOLDER_GET_CLASS (folder)->synchronize_sync (
-               folder, 0, cancellable, error)) {
-               camel_service_unlock (
-                       CAMEL_SERVICE (store),
-                       CAMEL_SERVICE_REC_CONNECT_LOCK);
+               folder, 0, cancellable, error))
                return FALSE;
-       }
 
        response = camel_imap_command (store, folder, cancellable, error, "UID SEARCH DELETED");
-       if (!response) {
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+       if (!response) 
                return FALSE;
-       }
+
        result = camel_imap_response_extract (store, response, "SEARCH", error);
-       if (!result) {
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+       if (!result)
                return FALSE;
-       }
 
        if (result[8] == ' ') {
                gchar *uid, *lasts = NULL;
@@ -2193,7 +2158,6 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
                        if (!response) {
                                g_ptr_array_free (keep_uids, TRUE);
                                g_ptr_array_free (mark_uids, TRUE);
-                               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                                return FALSE;
                        }
                        camel_imap_response_free (store, response);
@@ -2217,7 +2181,6 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
                        if (!response) {
                                g_ptr_array_free (keep_uids, TRUE);
                                g_ptr_array_free (mark_uids, TRUE);
-                               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                                return FALSE;
                        }
                        camel_imap_response_free (store, response);
@@ -2255,8 +2218,6 @@ camel_imap_expunge_uids_resyncing (CamelFolder *folder,
        /* now we can free this, now that we're done with keep_uids */
        g_free (result);
 
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return TRUE;
 }
 
@@ -2516,11 +2477,9 @@ imap_append_online (CamelFolder *folder,
        camel_imap_response_free (store, response);
 
        /* Make sure a "folder_changed" is emitted. */
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
        if (store->current_folder != folder ||
            camel_folder_summary_count (folder->summary) == count)
                success = imap_refresh_info_sync (folder, cancellable, error);
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        return success;
 }
@@ -2575,8 +2534,6 @@ imap_transfer_offline (CamelFolder *source,
                        GCancellable *cancellable,
                        GError **error)
 {
-       CamelStore *parent_store;
-       CamelImapStore *store;
        CamelImapMessageCache *sc = CAMEL_IMAP_FOLDER (source)->cache;
        CamelImapMessageCache *dc = CAMEL_IMAP_FOLDER (dest)->cache;
        CamelFolderChangeInfo *changes;
@@ -2586,18 +2543,13 @@ imap_transfer_offline (CamelFolder *source,
        gint i;
        GError *local_error = NULL;
 
-       parent_store = camel_folder_get_parent_store (source);
-       store = CAMEL_IMAP_STORE (parent_store);
-
        /* We grab the store's command lock first, and then grab the
         * source and destination cache_locks. This way we can't
         * deadlock in the case where we're simultaneously also trying
         * to copy messages in the other direction from another thread.
         */
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
        CAMEL_IMAP_FOLDER_REC_LOCK (source, cache_lock);
        CAMEL_IMAP_FOLDER_REC_LOCK (dest, cache_lock);
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        if (transferred_uids) {
                *transferred_uids = g_ptr_array_new ();
@@ -2865,15 +2817,12 @@ do_copy (CamelFolder *source,
 
                /* use XGWMOVE only when none of the moving messages has set any user tag */
                if ((store->capabilities & IMAP_CAPABILITY_XGWMOVE) != 0 && delete_originals && !any_has_user_tag (source, uidset)) {
-                       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                        response = camel_imap_command (
                                store, source, cancellable, &local_error,
                                "UID XGWMOVE %s %F", uidset, full_name);
                        /* returns only 'A00012 OK UID XGWMOVE completed' '* 2 XGWMOVE' so nothing useful */
                        camel_imap_response_free (store, response);
-                       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                } else {
-                       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                        response = camel_imap_command (
                                store, source, cancellable, &local_error,
                                "UID COPY %s %F", uidset, full_name);
@@ -2884,7 +2833,6 @@ do_copy (CamelFolder *source,
                                        response, source, destination,
                                        cancellable);
                        camel_imap_response_free (store, response);
-                       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                }
 
                if (local_error == NULL && delete_originals && (mark_moved || !trash_path)) {
@@ -3593,9 +3541,7 @@ imap_get_message_sync (CamelFolder *folder,
                                gchar *body, *found_uid;
                                gint i;
 
-                               camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                                if (!camel_imap_store_connected (store, NULL)) {
-                                       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                                        g_set_error (
                                                error, CAMEL_SERVICE_ERROR,
                                                CAMEL_SERVICE_ERROR_UNAVAILABLE,
@@ -3633,7 +3579,6 @@ imap_get_message_sync (CamelFolder *folder,
                                } else {
                                        g_clear_error (&local_error);
                                }
-                               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                        }
 
                        if (camel_debug_start("imap:folder")) {
@@ -4106,9 +4051,6 @@ imap_update_summary (CamelFolder *folder,
        camel_operation_pop_message (cancellable);
 
        if (type == CAMEL_IMAP_RESPONSE_ERROR || camel_application_is_exiting) {
-               if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
                g_string_free (header_spec, TRUE);
                goto lose;
        }
@@ -4181,9 +4123,6 @@ imap_update_summary (CamelFolder *folder,
                                g_string_free (header_spec, TRUE);
                                camel_operation_pop_message (cancellable);
 
-                               if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
-                                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
                                goto lose;
                        }
                }
@@ -4470,7 +4409,6 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder,
        if (stream || cache_only)
                return stream;
 
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
        CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
 
        if (!camel_imap_store_connected (store, NULL)) {
@@ -4479,7 +4417,6 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder,
                        CAMEL_SERVICE_ERROR_UNAVAILABLE,
                        _("This message is not currently available"));
                CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                return NULL;
        }
 
@@ -4496,7 +4433,6 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder,
 
        if (!response) {
                CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                return NULL;
        }
 
@@ -4512,7 +4448,6 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder,
        }
        camel_imap_response_free (store, response);
        CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
        if (!stream) {
                g_set_error (
                        error, CAMEL_ERROR,
@@ -4694,10 +4629,8 @@ imap_get_quota_info_sync (CamelFolder *folder,
        if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (imap_store)))
                return NULL;
 
-       camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if (!camel_imap_store_connected (imap_store, NULL))
-               goto done;
+               return NULL;
 
        if (imap_store->capabilities & IMAP_CAPABILITY_QUOTA) {
                const gchar *full_name = camel_folder_get_full_name (folder);
@@ -4770,8 +4703,7 @@ imap_get_quota_info_sync (CamelFolder *folder,
 
                g_free (folder_name);
        }
-done:
-       camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+
        return res;
 }
 
index 197b76d..5f30730 100644 (file)
@@ -838,10 +838,8 @@ imap_store_connect_sync (CamelService *service,
        if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
                return TRUE;
 
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
        if (!connect_to_server_wrapper (service, cancellable, error) ||
            !imap_auth_loop (service, cancellable, error)) {
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                camel_service_disconnect_sync (
                        service, TRUE, cancellable, NULL);
                return FALSE;
@@ -1015,8 +1013,6 @@ done:
        /* save any changes we had */
        camel_store_summary_save ((CamelStoreSummary *) store->summary);
 
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if (local_error != NULL) {
                camel_service_disconnect_sync (
                        service, TRUE, cancellable, NULL);
@@ -1243,12 +1239,10 @@ imap_store_query_auth_types_sync (CamelService *service,
                return NULL;
        }
 
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
        connected = store->istream != NULL && store->connected;
        if (!connected)
                connected = connect_to_server_wrapper (
                        service, cancellable, error);
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
        if (!connected)
                return NULL;
 
@@ -1411,29 +1405,20 @@ imap_store_subscribe_folder_sync (CamelSubscribable *subscribable,
                                   GCancellable *cancellable,
                                   GError **error)
 {
-       CamelService *service;
        CamelImapStore *imap_store;
        CamelImapResponse *response;
        CamelFolderInfo *fi;
        CamelStoreInfo *si;
-       gboolean success = TRUE;
 
-       service = CAMEL_SERVICE (subscribable);
        imap_store = CAMEL_IMAP_STORE (subscribable);
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_imap_store_connected (imap_store, error)) {
-               success = FALSE;
-               goto done;
-       }
+       if (!camel_imap_store_connected (imap_store, error))
+               return FALSE;
 
        response = camel_imap_command (imap_store, NULL, cancellable, error,
                                       "SUBSCRIBE %F", folder_name);
-       if (!response) {
-               success = FALSE;
-               goto done;
-       }
+       if (!response)
+               return FALSE;
 
        camel_imap_response_free (imap_store, response);
 
@@ -1451,7 +1436,7 @@ imap_store_subscribe_folder_sync (CamelSubscribable *subscribable,
                /* we don't need to emit a "folder_subscribed" signal
                 * if we are in the process of renaming folders, so we
                 * are done here... */
-               goto done;
+               return TRUE;
        }
 
        fi = imap_build_folder_info (imap_store, folder_name);
@@ -1460,10 +1445,7 @@ imap_store_subscribe_folder_sync (CamelSubscribable *subscribable,
        camel_subscribable_folder_subscribed (subscribable, fi);
        camel_folder_info_free (fi);
 
-done:
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return success;
+       return TRUE;
 }
 
 static gboolean
@@ -1472,36 +1454,23 @@ imap_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
                                     GCancellable *cancellable,
                                     GError **error)
 {
-       CamelService *service;
        CamelImapStore *imap_store;
        CamelImapResponse *response;
-       gboolean success = TRUE;
 
-       service = CAMEL_SERVICE (subscribable);
        imap_store = CAMEL_IMAP_STORE (subscribable);
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_imap_store_connected (imap_store, error)) {
-               success = FALSE;
-               goto done;
-       }
+       if (!camel_imap_store_connected (imap_store, error))
+               return FALSE;
 
        response = camel_imap_command (imap_store, NULL, cancellable, error,
                                       "UNSUBSCRIBE %F", folder_name);
-       if (!response) {
-               success = FALSE;
-               goto done;
-       }
+       if (!response)
+               return FALSE;
 
        camel_imap_response_free (imap_store, response);
 
-       success = imap_folder_effectively_unsubscribed (imap_store, folder_name, error);
-
-done:
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return success;
+       return imap_folder_effectively_unsubscribed (
+               imap_store, folder_name, error);
 }
 
 static void
@@ -1748,12 +1717,8 @@ imap_store_noop_sync (CamelStore *store,
        CamelFolder *current_folder;
        gboolean success = TRUE;
 
-       camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_imap_store_connected (imap_store, error)) {
-               success = FALSE;
-               goto done;
-       }
+       if (!camel_imap_store_connected (imap_store, error))
+               return FALSE;
 
        current_folder = imap_store->current_folder;
        if (current_folder && imap_summary_is_dirty (current_folder->summary)) {
@@ -1767,8 +1732,6 @@ imap_store_noop_sync (CamelStore *store,
                else
                        success = FALSE;
        }
-done:
-       camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        return success;
 }
@@ -2032,12 +1995,8 @@ imap_store_get_folder_sync (CamelStore *store,
                return NULL;
        }
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_imap_store_connected (imap_store, error)) {
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
+       if (!camel_imap_store_connected (imap_store, error))
                return NULL;
-       }
 
        if (!g_ascii_strcasecmp (folder_name, "INBOX"))
                folder_name = "INBOX";
@@ -2053,7 +2012,6 @@ imap_store_get_folder_sync (CamelStore *store,
                const gchar *c;
 
                if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                        g_propagate_error (error, local_error);
                        return NULL;
                }
@@ -2061,7 +2019,6 @@ imap_store_get_folder_sync (CamelStore *store,
                g_clear_error (&local_error);
 
                if (!(flags & CAMEL_STORE_FOLDER_CREATE)) {
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                        g_set_error (
                                error, CAMEL_STORE_ERROR,
                                CAMEL_STORE_ERROR_NO_FOLDER,
@@ -2075,7 +2032,6 @@ imap_store_get_folder_sync (CamelStore *store,
                        c++;
 
                if (*c != '\0') {
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                        g_set_error (
                                error, CAMEL_FOLDER_ERROR,
                                CAMEL_FOLDER_ERROR_INVALID_PATH,
@@ -2098,7 +2054,6 @@ imap_store_get_folder_sync (CamelStore *store,
                        gint i;
 
                        if (!(response = camel_imap_command (imap_store, NULL, cancellable, error, "LIST \"\" %G", parent_real))) {
-                               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                                g_free (parent_name);
                                g_free (parent_real);
                                return NULL;
@@ -2144,7 +2099,6 @@ imap_store_get_folder_sync (CamelStore *store,
                                                error, CAMEL_FOLDER_ERROR,
                                                CAMEL_FOLDER_ERROR_INVALID_STATE,
                                                _("The parent folder is not allowed to contain subfolders"));
-                                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                                        g_free (parent_name);
                                        g_free (parent_real);
                                        return NULL;
@@ -2153,7 +2107,6 @@ imap_store_get_folder_sync (CamelStore *store,
                                /* delete the old parent and recreate it */
                                if (!imap_store_delete_folder_sync (
                                        store, parent_name, cancellable, error)) {
-                                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                                        g_free (parent_name);
                                        g_free (parent_real);
                                        return NULL;
@@ -2166,7 +2119,6 @@ imap_store_get_folder_sync (CamelStore *store,
                                g_free (name);
 
                                if (!response) {
-                                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                                        g_free (parent_name);
                                        g_free (parent_real);
                                        return NULL;
@@ -2190,7 +2142,6 @@ imap_store_get_folder_sync (CamelStore *store,
                }
                g_free (folder_real);
                if (!response) {
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                        return NULL;
                }
        } else if (flags & CAMEL_STORE_FOLDER_EXCL) {
@@ -2201,8 +2152,6 @@ imap_store_get_folder_sync (CamelStore *store,
 
                camel_imap_response_free_without_processing (imap_store, response);
 
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
                return NULL;
        }
 
@@ -2224,8 +2173,6 @@ imap_store_get_folder_sync (CamelStore *store,
        }
        camel_imap_response_free_without_processing (imap_store, response);
 
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return new_folder;
 }
 
@@ -2285,19 +2232,13 @@ imap_store_delete_folder_sync (CamelStore *store,
        CamelImapResponse *response;
        gboolean success = TRUE;
 
-       camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_imap_store_connected (imap_store, error)) {
-               success = FALSE;
-               goto fail;
-       }
+       if (!camel_imap_store_connected (imap_store, error))
+               return FALSE;
 
        /* make sure this folder isn't currently SELECTed */
        response = camel_imap_command (imap_store, NULL, cancellable, error, "SELECT INBOX");
-       if (!response) {
-               success = FALSE;
-               goto fail;
-       }
+       if (!response)
+               return FALSE;
 
        camel_imap_response_free_without_processing (imap_store, response);
        if (imap_store->current_folder)
@@ -2312,9 +2253,6 @@ imap_store_delete_folder_sync (CamelStore *store,
        } else
                success = FALSE;
 
-fail:
-       camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return success;
 }
 
@@ -2418,8 +2356,6 @@ imap_store_rename_folder_sync (CamelStore *store,
        use_subscriptions = camel_imap_settings_get_use_subscriptions (
                CAMEL_IMAP_SETTINGS (settings));
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if (!camel_imap_store_connected (imap_store, error)) {
                success = FALSE;
                goto fail;
@@ -2499,7 +2435,6 @@ imap_store_rename_folder_sync (CamelStore *store,
        g_free (newpath);
 fail:
        imap_store->renaming = FALSE;
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        return success;
 }
@@ -2974,8 +2909,6 @@ refresh_refresh (CamelSession *session,
        namespace = camel_imap_settings_dup_namespace (
                CAMEL_IMAP_SETTINGS (settings));
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        camel_operation_push_message (cancellable,
                _("Retrieving list of folders at '%s'"),
                camel_service_get_display_name (service));
@@ -2998,7 +2931,6 @@ refresh_refresh (CamelSession *session,
 
 done:
        camel_operation_pop_message (cancellable);
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        g_free (namespace);
 }
@@ -3041,8 +2973,6 @@ imap_store_get_folder_info_sync (CamelStore *store,
                now = time (NULL);
                ref = now > imap_store->refresh_stamp + 60 * 60 * 1;
                if (ref) {
-                       camel_service_lock (
-                               service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                        ref = now > imap_store->refresh_stamp + 60 * 60 * 1;
                        if (ref) {
                                imap_store->refresh_stamp = now;
@@ -3053,18 +2983,14 @@ imap_store_get_folder_info_sync (CamelStore *store,
                                        g_object_ref (store),
                                        (GDestroyNotify) g_object_unref);
                        }
-                       camel_service_unlock (
-                               service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                }
        } else {
                gchar *pattern;
                gint i;
                CamelImapStoreNamespace *ns;
 
-               camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
                if (!camel_imap_store_connected ((CamelImapStore *) store, error))
-                       goto fail;
+                       return NULL;
 
                if (top[0] == 0) {
                        pattern = g_alloca (3);
@@ -3086,7 +3012,7 @@ imap_store_get_folder_info_sync (CamelStore *store,
 
                ns = camel_imap_store_summary_get_main_namespace (imap_store->summary);
                if (!get_folders_sync (imap_store, pattern, cancellable, error))
-                       goto fail;
+                       return NULL;
                if (pattern[0] != '*' && ns) {
                        pattern[i] = ns->sep;
                        pattern[i + 1] = (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) ? '*':'%';
@@ -3094,15 +3020,10 @@ imap_store_get_folder_info_sync (CamelStore *store,
                        get_folders_sync (imap_store, pattern, cancellable, NULL);
                }
                camel_store_summary_save ((CamelStoreSummary *) imap_store->summary);
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
        }
 
        tree = get_folder_info_offline (store, top, flags, error);
        return tree;
-
-fail:
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       return NULL;
 }
 
 static CamelFolderInfo *
index 94d151a..cee63ec 100644 (file)
@@ -189,8 +189,6 @@ nntp_folder_refresh_info_online (CamelFolder *folder,
        nntp_folder = CAMEL_NNTP_FOLDER (folder);
        nntp_store = CAMEL_NNTP_STORE (parent_store);
 
-       camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        /* When invoked with no fmt, camel_nntp_command() just selects the folder
         * and should return zero. */
        success = !camel_nntp_command (
@@ -201,8 +199,6 @@ nntp_folder_refresh_info_online (CamelFolder *folder,
                nntp_folder->changes = camel_folder_change_info_new ();
        }
 
-       camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if (changes) {
                camel_folder_changed (folder, changes);
                camel_folder_change_info_free (changes);
@@ -234,13 +230,7 @@ static gboolean
 nntp_folder_sync (CamelFolder *folder,
                   GError **error)
 {
-       CamelStore *parent_store;
        GPtrArray *changed;
-       gboolean success;
-
-       parent_store = camel_folder_get_parent_store (folder);
-
-       camel_service_lock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        changed = camel_folder_summary_get_changed (folder->summary);
        if (changed) {
@@ -249,10 +239,8 @@ nntp_folder_sync (CamelFolder *folder,
                g_ptr_array_free (changed, TRUE);
                camel_folder_summary_touch (folder->summary);
        }
-       success = camel_folder_summary_save_to_db (folder->summary, error);
-       camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
-       return success;
+       return camel_folder_summary_save_to_db (folder->summary, error);
 }
 
 static gboolean
@@ -359,17 +347,10 @@ nntp_folder_cache_message (CamelDiscoFolder *disco_folder,
                            GCancellable *cancellable,
                            GError **error)
 {
-       CamelFolder *folder;
-       CamelStore *parent_store;
-       CamelNNTPStore *nntp_store;
        CamelStream *stream;
        gchar *article, *msgid;
        gboolean success = TRUE;
 
-       folder = CAMEL_FOLDER (disco_folder);
-       parent_store = camel_folder_get_parent_store (folder);
-       nntp_store = CAMEL_NNTP_STORE (parent_store);
-
        article = alloca (strlen (uid) + 1);
        strcpy (article, uid);
        msgid = strchr (article, ',');
@@ -381,8 +362,6 @@ nntp_folder_cache_message (CamelDiscoFolder *disco_folder,
        }
        *msgid++ = 0;
 
-       camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        stream = nntp_folder_download_message (
                (CamelNNTPFolder *) disco_folder, article, msgid, cancellable, error);
        if (stream)
@@ -390,8 +369,6 @@ nntp_folder_cache_message (CamelDiscoFolder *disco_folder,
        else
                success = FALSE;
 
-       camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return success;
 }
 
@@ -506,8 +483,6 @@ nntp_folder_get_message_sync (CamelFolder *folder,
        }
        *msgid++ = 0;
 
-       camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        /* Lookup in cache, NEWS is global messageid's so use a global cache path */
        stream = camel_data_cache_get (nntp_store->cache, "cache", msgid, NULL);
        if (stream == NULL) {
@@ -540,8 +515,6 @@ fail:
                changes = NULL;
        }
 
-       camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if (changes) {
                camel_folder_changed (folder, changes);
                camel_folder_change_info_free (changes);
@@ -576,8 +549,6 @@ nntp_folder_append_message_online (CamelFolder *folder,
        nntp_store = CAMEL_NNTP_STORE (parent_store);
        stream = CAMEL_STREAM (nntp_store->stream);
 
-       camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        /* send 'POST' command */
        ret = camel_nntp_command (nntp_store, cancellable, error, NULL, &line, "post");
        if (ret != 340) {
@@ -594,7 +565,6 @@ nntp_folder_append_message_online (CamelFolder *folder,
                                _("Posting failed: %s"), line);
                        success = FALSE;
                }
-               camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                return success;
        }
 
@@ -646,8 +616,6 @@ nntp_folder_append_message_online (CamelFolder *folder,
        g_free (group);
        header->next = savedhdrs;
 
-       camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return success;
 }
 
index 037d2cf..0974dcb 100644 (file)
@@ -268,8 +268,6 @@ connect_to_server (CamelService *service,
        host = camel_network_settings_dup_host (network_settings);
        user = camel_network_settings_dup_user (network_settings);
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        tcp_stream = camel_network_service_connect_sync (
                CAMEL_NETWORK_SERVICE (service), cancellable, error);
 
@@ -332,8 +330,6 @@ connect_to_server (CamelService *service,
        store->current_folder = NULL;
 
 fail:
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        g_free (host);
        g_free (user);
 
@@ -360,7 +356,6 @@ nntp_connect_online (CamelService *service,
        store->capabilities = 0;
 
        /* disconnect and reconnect without capability check */
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        if (store->stream)
                g_object_unref (store->stream);
@@ -368,8 +363,6 @@ nntp_connect_online (CamelService *service,
        g_free (store->current_folder);
        store->current_folder = NULL;
 
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return connect_to_server (service, cancellable, error);
 }
 
@@ -418,8 +411,6 @@ nntp_disconnect_online (CamelService *service,
        CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
        gchar *line;
 
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if (clean)
                camel_nntp_raw_command (store, cancellable, NULL, &line, "quit");
 
@@ -428,8 +419,6 @@ nntp_disconnect_online (CamelService *service,
        g_free (store->current_folder);
        store->current_folder = NULL;
 
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return TRUE;
 }
 
@@ -560,21 +549,8 @@ nntp_get_folder (CamelStore *store,
                  GCancellable *cancellable,
                  GError **error)
 {
-       CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
-       CamelFolder *folder;
-
-       camel_service_lock (
-               CAMEL_SERVICE (nntp_store),
-               CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       folder = camel_nntp_folder_new (
+       return camel_nntp_folder_new (
                store, folder_name, cancellable, error);
-
-       camel_service_unlock (
-               CAMEL_SERVICE (nntp_store),
-               CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return folder;
 }
 
 /*
@@ -757,14 +733,12 @@ nntp_store_get_subscribed_folder_info (CamelNNTPStore *store,
                                if (folder) {
                                        CamelFolderChangeInfo *changes = NULL;
 
-                                       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                                        if (camel_nntp_command (store, cancellable, NULL, folder, &line, NULL) != -1) {
                                                if (camel_folder_change_info_changed (folder->changes)) {
                                                        changes = folder->changes;
                                                        folder->changes = camel_folder_change_info_new ();
                                                }
                                        }
-                                       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
                                        if (changes) {
                                                camel_folder_changed (CAMEL_FOLDER (folder), changes);
                                                camel_folder_change_info_free (changes);
@@ -1024,8 +998,6 @@ nntp_store_get_folder_info_all (CamelNNTPStore *nntp_store,
        gint ret = -1;
        CamelFolderInfo *fi = NULL;
 
-       camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        if (top == NULL)
                top = "";
 
@@ -1095,8 +1067,7 @@ nntp_store_get_folder_info_all (CamelNNTPStore *nntp_store,
        }
 
        fi = nntp_store_get_cached_folder_info (nntp_store, top, flags, error);
- error:
-       camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+error:
 
        return fi;
 }
@@ -1392,8 +1363,6 @@ nntp_store_subscribe_folder_sync (CamelSubscribable *subscribable,
        short_folder_names = camel_nntp_settings_get_short_folder_names (
                CAMEL_NNTP_SETTINGS (settings));
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        si = camel_store_summary_path (CAMEL_STORE_SUMMARY (nntp_store->summary), folder_name);
        if (!si) {
                g_set_error (
@@ -1410,15 +1379,11 @@ nntp_store_subscribe_folder_sync (CamelSubscribable *subscribable,
                        fi->flags |= CAMEL_FOLDER_NOINFERIORS | CAMEL_FOLDER_NOCHILDREN;
                        camel_store_summary_touch ((CamelStoreSummary *) nntp_store->summary);
                        camel_store_summary_save ((CamelStoreSummary *) nntp_store->summary);
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                        camel_subscribable_folder_subscribed (subscribable, fi);
                        camel_folder_info_free (fi);
-                       return TRUE;
                }
        }
 
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return success;
 }
 
@@ -1442,8 +1407,6 @@ nntp_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
        short_folder_names = camel_nntp_settings_get_short_folder_names (
                CAMEL_NNTP_SETTINGS (settings));
 
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        fitem = camel_store_summary_path (CAMEL_STORE_SUMMARY (nntp_store->summary), folder_name);
 
        if (!fitem) {
@@ -1459,15 +1422,11 @@ nntp_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
                        fi = nntp_folder_info_from_store_info (nntp_store, short_folder_names, fitem);
                        camel_store_summary_touch ((CamelStoreSummary *) nntp_store->summary);
                        camel_store_summary_save ((CamelStoreSummary *) nntp_store->summary);
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
                        camel_subscribable_folder_unsubscribed (subscribable, fi);
                        camel_folder_info_free (fi);
-                       return TRUE;
                }
        }
 
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
        return success;
 }
 
index d9bf763..c850839 100644 (file)
@@ -1973,9 +1973,6 @@ camel_service_get_session
 camel_service_get_settings
 camel_service_set_settings
 camel_service_get_uid
-CamelServiceLock
-camel_service_lock
-camel_service_unlock
 camel_service_connect_sync
 camel_service_connect
 camel_service_connect_finish