aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-08-27 00:45:50 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-08-27 00:45:50 +0800
commit4db7ee0b5021bd9c782ad3810d58a450f34def49 (patch)
treebe05b4246bfa30374d679a72cd6b96117a8df2e0 /camel/providers
parentc0a5e7b7890928a52aa42b131f584ef3acbd5bde (diff)
downloadgsoc2013-evolution-4db7ee0b5021bd9c782ad3810d58a450f34def49.tar.gz
gsoc2013-evolution-4db7ee0b5021bd9c782ad3810d58a450f34def49.tar.zst
gsoc2013-evolution-4db7ee0b5021bd9c782ad3810d58a450f34def49.zip
Lock the CamelService->priv->connect_lock instead of using our own
2002-08-26 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-store.c: * providers/imap/camel-imap-folder.c: * providers/imap/camel-imap-command.c: Lock the CamelService->priv->connect_lock instead of using our own command_lock. This fixes bug #28177. svn path=/trunk/; revision=17861
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-command.c31
-rw-r--r--camel/providers/imap/camel-imap-folder.c79
-rw-r--r--camel/providers/imap/camel-imap-private.h26
-rw-r--r--camel/providers/imap/camel-imap-store.c50
-rw-r--r--camel/providers/imap/camel-imap-store.h1
5 files changed, 85 insertions, 102 deletions
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index a0a423dc84..3634eb389d 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -39,6 +39,7 @@
#include "camel-imap-store.h"
#include "camel-imap-private.h"
#include <camel/camel-exception.h>
+#include <camel/camel-private.h>
#define d(x) x
@@ -73,7 +74,7 @@ static char *imap_command_strdup_printf (CamelImapStore *store,
*
* See camel_imap_command_start() for details on @fmt.
*
- * On success, the store's command_lock will be locked. It will be freed
+ * On success, the store's connect_lock will be locked. It will be freed
* when you call camel_imap_response_free. (The lock is recursive, so
* callers can grab and release it themselves if they need to run
* multiple commands atomically.)
@@ -89,7 +90,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder,
va_list ap;
char *cmd;
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
if (fmt) {
va_start (ap, fmt);
@@ -108,7 +109,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder,
if (!imap_command_start (store, folder, cmd, ex)) {
g_free (cmd);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
return NULL;
}
g_free (cmd);
@@ -140,7 +141,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder,
* %F will have the imap store's namespace prepended and then be processed
* like %S.
*
- * On success, the store's command_lock will be locked. It will be
+ * On success, the store's connect_lock will be locked. It will be
* freed when %CAMEL_IMAP_RESPONSE_TAGGED or %CAMEL_IMAP_RESPONSE_ERROR
* is returned from camel_imap_command_response(). (The lock is
* recursive, so callers can grab and release it themselves if they
@@ -161,12 +162,12 @@ camel_imap_command_start (CamelImapStore *store, CamelFolder *folder,
cmd = imap_command_strdup_vprintf (store, fmt, ap);
va_end (ap);
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
ok = imap_command_start (store, folder, cmd, ex);
g_free (cmd);
if (!ok)
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
return ok;
}
@@ -243,7 +244,7 @@ imap_command_start (CamelImapStore *store, CamelFolder *folder,
* This function assumes you have an exclusive lock on the imap stream.
*
* Return value: as for camel_imap_command(). On failure, the store's
- * command_lock will be released.
+ * connect_lock will be released.
**/
CamelImapResponse *
camel_imap_command_continuation (CamelImapStore *store, const char *cmd,
@@ -261,7 +262,7 @@ camel_imap_command_continuation (CamelImapStore *store, const char *cmd,
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
g_strerror (errno));
camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
return NULL;
}
@@ -291,7 +292,7 @@ camel_imap_command_response (CamelImapStore *store, char **response,
char *respbuf;
if (camel_imap_store_readline (store, &respbuf, ex) < 0) {
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
return CAMEL_IMAP_RESPONSE_ERROR;
}
@@ -328,7 +329,7 @@ camel_imap_command_response (CamelImapStore *store, char **response,
if (type == CAMEL_IMAP_RESPONSE_ERROR ||
type == CAMEL_IMAP_RESPONSE_TAGGED)
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
return type;
}
@@ -345,7 +346,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex)
* we're still locked. This lock is owned by response
* and gets unlocked when response is freed.
*/
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
response = g_new0 (CamelImapResponse, 1);
if (store->current_folder && camel_disco_store_status (CAMEL_DISCO_STORE (store)) != CAMEL_DISCO_STORE_RESYNCING) {
@@ -521,7 +522,7 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex)
* @response: a CamelImapResponse
*
* Frees all of the data in @response and processes any untagged
- * EXPUNGE and EXISTS responses in it. Releases @store's command_lock.
+ * EXPUNGE and EXISTS responses in it. Releases @store's connect_lock.
**/
void
camel_imap_response_free (CamelImapStore *store, CamelImapResponse *response)
@@ -568,7 +569,7 @@ camel_imap_response_free (CamelImapStore *store, CamelImapResponse *response)
}
g_free (response);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
}
/**
@@ -601,7 +602,7 @@ camel_imap_response_free_without_processing (CamelImapStore *store,
* type @type and returns just that response data. If @response
* doesn't contain the right information, the function will set @ex
* and return %NULL. Either way, @response will be freed and the
- * store's command_lock released.
+ * store's connect_lock released.
*
* Return value: the desired response string, which the caller must free.
**/
@@ -649,7 +650,7 @@ camel_imap_response_extract (CamelImapStore *store,
*
* This checks that @response contains a continuation response, and
* returns just that data. If @response doesn't contain a continuation
- * response, the function will set @ex, release @store's command_lock,
+ * response, the function will set @ex, release @store's connect_lock,
* and return %NULL. Either way, @response will be freed.
*
* Return value: the desired response string, which the caller must free.
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index e294cd749b..a85ae05fab 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -65,6 +65,7 @@
#include "camel-stream-mem.h"
#include "camel-stream.h"
#include "string-utils.h"
+#include "camel-private.h"
#define d(x) x
@@ -256,7 +257,7 @@ camel_imap_folder_new (CamelStore *parent, const char *folder_name,
return folder;
}
-/* Called with the store's command_lock locked */
+/* Called with the store's connect_lock locked */
void
camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
CamelException *ex)
@@ -269,7 +270,7 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
int i, count;
char *resp;
- CAMEL_IMAP_STORE_ASSERT_LOCKED (folder->parent_store, command_lock);
+ CAMEL_SERVICE_ASSERT_LOCKED (folder->parent_store, connect_lock);
count = camel_folder_summary_count (folder->summary);
@@ -478,9 +479,9 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
/* If the folder isn't selected, select it (which will force
* a rescan if one is needed).
*/
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+ CAMEL_SERVICE_LOCK (imap_store, connect_lock);
if (imap_store->current_folder != folder) {
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_LOCK (imap_store, connect_lock);
response = camel_imap_command (imap_store, folder, ex, NULL);
if (response) {
camel_imap_folder_selected (folder, response, NULL);
@@ -488,7 +489,7 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
}
return;
}
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_LOCK (imap_store, connect_lock);
/* Otherwise, if we need a rescan, do it, and if not, just do
* a NOOP to give the server a chance to tell us about new
@@ -502,7 +503,7 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
}
}
-/* Called with the store's command_lock locked */
+/* Called with the store's connect_lock locked */
static void
imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
{
@@ -521,7 +522,7 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
gboolean ok;
CamelFolderChangeInfo *changes = NULL;
- CAMEL_IMAP_STORE_ASSERT_LOCKED (store, command_lock);
+ CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
imap_folder->need_rescan = FALSE;
summary_len = camel_folder_summary_count (folder->summary);
@@ -727,7 +728,7 @@ imap_sync_online (CamelFolder *folder, CamelException *ex)
int i, j, max;
camel_exception_init (&local_ex);
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
/* Find a message with changed flags, find all of the other
* messages like it, sync them as a group, mark them as
@@ -787,8 +788,8 @@ imap_sync_online (CamelFolder *folder, CamelException *ex)
}
g_ptr_array_free (matches, TRUE);
- /* We unlock here so that other threads can have a chance to grab the command_lock */
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ /* We unlock here so that other threads can have a chance to grab the connect_lock */
+ CAMEL_SERVICE_LOCK (store, connect_lock);
/* check for an exception */
if (camel_exception_is_set (&local_ex)) {
@@ -796,14 +797,14 @@ imap_sync_online (CamelFolder *folder, CamelException *ex)
return;
}
- /* Re-lock the command_lock */
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ /* Re-lock the connect_lock */
+ CAMEL_SERVICE_LOCK (store, connect_lock);
}
/* Save the summary */
imap_sync_offline (folder, ex);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
}
static void
@@ -838,12 +839,12 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
int uid = 0;
char *set;
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
if ((store->capabilities & IMAP_CAPABILITY_UIDPLUS) == 0) {
((CamelFolderClass *)CAMEL_OBJECT_GET_CLASS(folder))->sync(folder, 0, ex);
if (camel_exception_is_set(ex)) {
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
return;
}
}
@@ -856,7 +857,7 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
if (response)
camel_imap_response_free (store, response);
if (camel_exception_is_set (ex)) {
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
g_free (set);
return;
}
@@ -871,7 +872,7 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
camel_imap_response_free (store, response);
}
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
}
static int
@@ -909,22 +910,22 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
* marked un-deleted.
*/
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
((CamelFolderClass *)CAMEL_OBJECT_GET_CLASS(folder))->sync(folder, 0, ex);
if (camel_exception_is_set(ex)) {
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
return;
}
response = camel_imap_command (store, folder, ex, "UID SEARCH DELETED");
if (!response) {
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
return;
}
result = camel_imap_response_extract (store, response, "SEARCH", ex);
if (!result) {
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
return;
}
@@ -985,7 +986,7 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
if (!response) {
g_ptr_array_free (keep_uids, TRUE);
g_ptr_array_free (mark_uids, TRUE);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
return;
}
camel_imap_response_free (store, response);
@@ -1009,7 +1010,7 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
if (!response) {
g_ptr_array_free (keep_uids, TRUE);
g_ptr_array_free (mark_uids, TRUE);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
return;
}
camel_imap_response_free (store, response);
@@ -1049,7 +1050,7 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
/* now we can free this, now that we're done with keep_uids */
g_free (result);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
}
static gchar *
@@ -1213,11 +1214,11 @@ imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
camel_imap_response_free (store, response);
/* Make sure a "folder_changed" is emitted. */
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
if (store->current_folder != folder ||
camel_folder_summary_count (folder->summary) == count)
imap_refresh_info (folder, ex);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
}
static void
@@ -1272,10 +1273,10 @@ imap_transfer_offline (CamelFolder *source, GPtrArray *uids,
* deadlock in the case where we're simultaneously also trying
* to copy messages in the other direction from another thread.
*/
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
CAMEL_IMAP_FOLDER_LOCK (source, cache_lock);
CAMEL_IMAP_FOLDER_LOCK (dest, cache_lock);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
if (transferred_uids) {
*transferred_uids = g_ptr_array_new ();
@@ -1423,11 +1424,11 @@ imap_transfer_online (CamelFolder *source, GPtrArray *uids,
return;
/* Make the destination notice its new messages */
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
if (store->current_folder != dest ||
camel_folder_summary_count (dest->summary) == count)
camel_folder_refresh_info (dest, ex);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
if (delete_originals) {
for (i = 0; i < uids->len; i++)
@@ -2032,7 +2033,7 @@ imap_update_summary (CamelFolder *folder, int exists,
char *uid, *resp;
GData *data;
- CAMEL_IMAP_STORE_ASSERT_LOCKED (store, command_lock);
+ CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
if (store->server_level >= IMAP_LEVEL_IMAP4REV1)
header_spec = "HEADER";
else
@@ -2308,7 +2309,7 @@ imap_update_summary (CamelFolder *folder, int exists,
}
}
-/* Called with the store's command_lock locked */
+/* Called with the store's connect_lock locked */
void
camel_imap_folder_changed (CamelFolder *folder, int exists,
GArray *expunged, CamelException *ex)
@@ -2318,7 +2319,7 @@ camel_imap_folder_changed (CamelFolder *folder, int exists,
CamelMessageInfo *info;
int len;
- CAMEL_IMAP_STORE_ASSERT_LOCKED (folder->parent_store, command_lock);
+ CAMEL_SERVICE_ASSERT_LOCKED (folder->parent_store, connect_lock);
changes = camel_folder_change_info_new ();
if (expunged) {
@@ -2385,11 +2386,11 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid,
/* EXPUNGE responses have to modify the cache, which means
* they have to grab the cache_lock while holding the
- * command_lock. So we grab the command_lock now, in case
+ * connect_lock. So we grab the connect_lock now, in case
* we're going to need it below, since we can't grab it
* after the cache_lock.
*/
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text);
@@ -2397,7 +2398,7 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid,
stream = camel_imap_message_cache_get (imap_folder->cache, uid, "");
if (stream || cache_only) {
CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
return stream;
}
@@ -2405,7 +2406,7 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid,
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
_("This message is not currently available"));
CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
return NULL;
}
@@ -2418,8 +2419,8 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid,
"UID FETCH %s BODY.PEEK[%s]",
uid, section_text);
}
- /* We won't need the command_lock again after this. */
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ /* We won't need the connect_lock again after this. */
+ CAMEL_SERVICE_LOCK (store, connect_lock);
if (!response) {
CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
diff --git a/camel/providers/imap/camel-imap-private.h b/camel/providers/imap/camel-imap-private.h
index 07b790c6a1..0f80dbfd1c 100644
--- a/camel/providers/imap/camel-imap-private.h
+++ b/camel/providers/imap/camel-imap-private.h
@@ -26,35 +26,17 @@
#ifdef __cplusplus
extern "C" {
#pragma }
-#endif /* __cplusplus }*/
+#endif /* __cplusplus */
/* need a way to configure and save this data, if this header is to
be installed. For now, dont install it */
-#include "config.h"
-
-#ifdef ENABLE_THREADS
-#include "e-util/e-msgport.h"
-#endif
-
-struct _CamelImapStorePrivate {
-#ifdef ENABLE_THREADS
- EMutex *command_lock; /* for locking the command stream for a complete operation */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
#endif
-};
#ifdef ENABLE_THREADS
-#define CAMEL_IMAP_STORE_LOCK(f, l) (e_mutex_lock(((CamelImapStore *)f)->priv->l))
-#define CAMEL_IMAP_STORE_UNLOCK(f, l) (e_mutex_unlock(((CamelImapStore *)f)->priv->l))
-# if 0
-# define CAMEL_IMAP_STORE_ASSERT_LOCKED(f, l) (e_mutex_assert_locked(((CamelImapStore *)f)->priv->l))
-# else
-# define CAMEL_IMAP_STORE_ASSERT_LOCKED(f, l)
-# endif
-#else
-#define CAMEL_IMAP_STORE_LOCK(f, l)
-#define CAMEL_IMAP_STORE_UNLOCK(f, l)
-#define CAMEL_IMAP_STORE_ASSERT_LOCKED(f, l)
+#include "e-util/e-msgport.h"
#endif
struct _CamelImapFolderPrivate {
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 63ca5834f7..9b45f123d7 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -66,6 +66,10 @@
#define IMAP_PORT 143
#define SIMAP_PORT 993
+/* this enables an experimental fix for bug #28177 */
+#define COMMAND_LOCK_IS_CONNECT_LOCK
+
+
extern int camel_verbose_debug;
static CamelDiscoStoreClass *parent_class = NULL;
@@ -195,10 +199,8 @@ camel_imap_store_finalize (CamelObject *object)
g_free (imap_store->storage_path);
#ifdef ENABLE_THREADS
- e_mutex_destroy (imap_store->priv->command_lock);
e_thread_destroy (imap_store->async_thread);
#endif
- g_free (imap_store->priv);
}
#ifdef ENABLE_THREADS
@@ -261,13 +263,11 @@ camel_imap_store_init (gpointer object, gpointer klass)
if (imap_tag_prefix > 'Z')
imap_tag_prefix = 'A';
- imap_store->priv = g_malloc0 (sizeof (*imap_store->priv));
#ifdef ENABLE_THREADS
- imap_store->priv->command_lock = e_mutex_new (E_MUTEX_REC);
imap_store->async_thread = e_thread_new(E_THREAD_QUEUE);
e_thread_set_msg_destroy(imap_store->async_thread, async_destroy, imap_store);
e_thread_set_msg_received(imap_store->async_thread, async_received, imap_store);
-#endif
+#endif /* ENABLE_THREADS */
}
CamelType
@@ -472,7 +472,7 @@ imap_get_capability (CamelService *service, CamelException *ex)
char *result, *capa, *lasts;
int i;
- CAMEL_IMAP_STORE_ASSERT_LOCKED (store, command_lock);
+ CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
/* Find out the IMAP capabilities */
/* We assume we have utf8 capable search until a failed search tells us otherwise */
@@ -744,9 +744,9 @@ query_auth_types (CamelService *service, CamelException *ex)
if (!camel_disco_store_check_online (CAMEL_DISCO_STORE (store), ex))
return NULL;
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
connected = connect_to_server_wrapper (service, ex);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
if (!connected)
return NULL;
@@ -955,7 +955,7 @@ try_auth (CamelImapStore *store, const char *mech, CamelException *ex)
char *resp;
char *sasl_resp;
- CAMEL_IMAP_STORE_ASSERT_LOCKED (store, command_lock);
+ CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
response = camel_imap_command (store, NULL, ex, "AUTHENTICATE %s", mech);
if (!response)
@@ -1018,7 +1018,7 @@ imap_auth_loop (CamelService *service, CamelException *ex)
char *errbuf = NULL;
gboolean authenticated = FALSE;
- CAMEL_IMAP_STORE_ASSERT_LOCKED (store, command_lock);
+ CAMEL_SERVICE_ASSERT_LOCKED (store, connect_lock);
if (service->url->authmech) {
if (!g_hash_table_lookup (store->authtypes, service->url->authmech)) {
@@ -1138,10 +1138,10 @@ imap_connect_online (CamelService *service, CamelException *ex)
int i, flags;
size_t len;
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
+ CAMEL_SERVICE_LOCK (store, connect_lock);
if (!connect_to_server_wrapper (service, ex) ||
!imap_auth_loop (service, ex)) {
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
camel_service_disconnect (service, TRUE, NULL);
return FALSE;
}
@@ -1267,7 +1267,7 @@ imap_connect_online (CamelService *service, CamelException *ex)
done:
fclose (storeinfo);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
if (camel_exception_is_set (ex))
camel_service_disconnect (service, TRUE, NULL);
@@ -1433,7 +1433,7 @@ imap_noop (CamelStore *store, CamelException *ex)
if (camel_disco_store_status (disco) != CAMEL_DISCO_STORE_ONLINE)
return;
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+ CAMEL_SERVICE_LOCK (imap_store, connect_lock);
current_folder = imap_store->current_folder;
if (current_folder && imap_summary_is_dirty (current_folder->summary)) {
@@ -1445,7 +1445,7 @@ imap_noop (CamelStore *store, CamelException *ex)
camel_imap_response_free (imap_store, response);
}
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
}
static guint
@@ -1534,7 +1534,7 @@ get_folder_online (CamelStore *store, const char *folder_name,
folder_name = "INBOX";
/* Lock around the whole lot to check/create atomically */
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+ CAMEL_SERVICE_LOCK (imap_store, connect_lock);
if (imap_store->current_folder) {
camel_object_unref (CAMEL_OBJECT (imap_store->current_folder));
imap_store->current_folder = NULL;
@@ -1543,7 +1543,7 @@ get_folder_online (CamelStore *store, const char *folder_name,
"SELECT %F", folder_name);
if (!response) {
if (!flags & CAMEL_STORE_FOLDER_CREATE) {
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
return no_such_folder (folder_name, ex);
}
@@ -1556,7 +1556,7 @@ get_folder_online (CamelStore *store, const char *folder_name,
"SELECT %F", folder_name);
}
if (!response) {
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
return NULL;
}
}
@@ -1584,7 +1584,7 @@ get_folder_online (CamelStore *store, const char *folder_name,
}
camel_imap_response_free_without_processing (imap_store, response);
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
return new_folder;
}
@@ -1634,14 +1634,14 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
if (response) {
camel_imap_response_free_without_processing (imap_store, response);
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+ CAMEL_SERVICE_LOCK (imap_store, connect_lock);
if (imap_store->current_folder)
camel_object_unref (CAMEL_OBJECT (imap_store->current_folder));
/* no need to actually create a CamelFolder for INBOX */
imap_store->current_folder = NULL;
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
} else
return;
@@ -1720,14 +1720,14 @@ rename_folder (CamelStore *store, const char *old_name, const char *new_name, Ca
if (response) {
camel_imap_response_free_without_processing (imap_store, response);
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+ CAMEL_SERVICE_LOCK (imap_store, connect_lock);
if (imap_store->current_folder)
camel_object_unref (CAMEL_OBJECT (imap_store->current_folder));
/* no need to actually create a CamelFolder for INBOX */
imap_store->current_folder = NULL;
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
} else
return;
@@ -2102,7 +2102,7 @@ get_folder_counts(CamelImapStore *imap_store, CamelFolderInfo *fi, CamelExceptio
&& ( (imap_store->parameters & IMAP_PARAM_CHECK_ALL)
|| strcasecmp(fi->full_name, "inbox") == 0) ) {
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+ CAMEL_SERVICE_LOCK (imap_store, connect_lock);
/* For the current folder, poke it to check for new
* messages and then report that number, rather than
* doing a STATUS command.
@@ -2115,7 +2115,7 @@ get_folder_counts(CamelImapStore *imap_store, CamelFolderInfo *fi, CamelExceptio
} else
fi->unread_message_count = get_folder_status (imap_store, fi->full_name, "UNSEEN");
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+ CAMEL_SERVICE_UNLOCK (imap_store, connect_lock);
} else {
fi->unread_message_count = -1;
}
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index bf3003265e..499c282649 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -99,7 +99,6 @@ typedef enum {
struct _CamelImapStore {
CamelDiscoStore parent_object;
- struct _CamelImapStorePrivate *priv;
CamelStream *istream;
CamelStream *ostream;