[evolution-data-server] [IMAPx] Connection could be used by two jobs at the same time
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [IMAPx] Connection could be used by two jobs at the same time
- Date: Fri, 7 Aug 2015 09:20:15 +0000 (UTC)
commit caab68219fc40e4f083384a55c287e50acc37c13
Author: Milan Crha <mcrha redhat com>
Date: Fri Aug 7 11:19:03 2015 +0200
[IMAPx] Connection could be used by two jobs at the same time
Which is not allowed now. It happened as a corner case, with a specific
thread interleaving on pending jobs.
camel/providers/imapx/camel-imapx-conn-manager.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-conn-manager.c
b/camel/providers/imapx/camel-imapx-conn-manager.c
index 280caeb..eb20aa3 100644
--- a/camel/providers/imapx/camel-imapx-conn-manager.c
+++ b/camel/providers/imapx/camel-imapx-conn-manager.c
@@ -603,7 +603,6 @@ imapx_conn_manager_connection_wait_cancelled_cb (GCancellable *cancellable,
static ConnectionInfo *
camel_imapx_conn_manager_ref_connection (CamelIMAPXConnManager *conn_man,
CamelIMAPXMailbox *mailbox,
- gboolean mark_as_busy,
GCancellable *cancellable,
GError **error)
{
@@ -646,6 +645,7 @@ camel_imapx_conn_manager_ref_connection (CamelIMAPXConnManager *conn_man,
if (candidate && !connection_info_get_busy (candidate)) {
cinfo = connection_info_ref (candidate);
+ connection_info_set_busy (cinfo, TRUE);
break;
}
}
@@ -665,6 +665,8 @@ camel_imapx_conn_manager_ref_connection (CamelIMAPXConnManager *conn_man,
CON_READ_UNLOCK (conn_man);
CON_WRITE_LOCK (conn_man);
cinfo = imapx_create_new_connection_unlocked (conn_man, mailbox, cancellable,
&local_error_2);
+ if (cinfo)
+ connection_info_set_busy (cinfo, TRUE);
CON_WRITE_UNLOCK (conn_man);
CON_READ_LOCK (conn_man);
@@ -714,9 +716,6 @@ camel_imapx_conn_manager_ref_connection (CamelIMAPXConnManager *conn_man,
}
}
- if (cinfo && mark_as_busy)
- connection_info_set_busy (cinfo, TRUE);
-
CON_READ_UNLOCK (conn_man);
g_mutex_lock (&conn_man->priv->pending_connections_lock);
@@ -786,8 +785,9 @@ camel_imapx_conn_manager_connect_sync (CamelIMAPXConnManager *conn_man,
}
CON_READ_UNLOCK (conn_man);
- cinfo = camel_imapx_conn_manager_ref_connection (conn_man, NULL, FALSE, cancellable, error);
+ cinfo = camel_imapx_conn_manager_ref_connection (conn_man, NULL, cancellable, error);
if (cinfo) {
+ imapx_conn_manager_unmark_busy (conn_man, cinfo);
connection_info_unref (cinfo);
}
@@ -938,7 +938,7 @@ camel_imapx_conn_manager_run_job_sync (CamelIMAPXConnManager *conn_man,
do {
g_clear_error (&local_error);
- cinfo = camel_imapx_conn_manager_ref_connection (conn_man, camel_imapx_job_get_mailbox (job),
TRUE, cancellable, error);
+ cinfo = camel_imapx_conn_manager_ref_connection (conn_man, camel_imapx_job_get_mailbox (job),
cancellable, error);
if (cinfo) {
success = camel_imapx_server_stop_idle_sync (cinfo->is, cancellable, &local_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]