[evolution] Disconnect the store when connected it on send from an Outbox
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Disconnect the store when connected it on send from an Outbox
- Date: Tue, 8 Jul 2014 11:03:07 +0000 (UTC)
commit 28391aa9253135c92228b7c6ebd49268e23acdee
Author: Milan Crha <mcrha redhat com>
Date: Tue Jul 8 13:00:34 2014 +0200
Disconnect the store when connected it on send from an Outbox
When there was a send from the Outbox folder, then the transport
service was connected when needed, but not disconnected after
the send was finished. That could mean that any later send from
the Outbox for this service could fail.because the server disconnected
meanwhile.
libemail-engine/mail-ops.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c
index 67fc5a9..c12555f 100644
--- a/libemail-engine/mail-ops.c
+++ b/libemail-engine/mail-ops.c
@@ -591,6 +591,7 @@ mail_send_message (struct _send_queue_msg *m,
CamelMimeMessage *message;
gint i;
GError *local_error = NULL;
+ gboolean did_connect = FALSE;
message = camel_folder_get_message_sync (
queue, uid, cancellable, error);
@@ -668,6 +669,8 @@ mail_send_message (struct _send_queue_msg *m,
if (!camel_service_connect_sync (service, cancellable, error))
goto exit;
+
+ did_connect = TRUE;
}
/* expand, or remove empty, group addresses */
@@ -841,6 +844,19 @@ mail_send_message (struct _send_queue_msg *m,
}
exit:
+ if (did_connect) {
+ /* Disconnect regardless of error or cancellation,
+ * but be mindful of these conditions when calling
+ * camel_service_disconnect_sync(). */
+ if (g_cancellable_is_cancelled (cancellable)) {
+ camel_service_disconnect_sync (service, FALSE, NULL, NULL);
+ } else if (error != NULL) {
+ camel_service_disconnect_sync (service, FALSE, cancellable, NULL);
+ } else {
+ camel_service_disconnect_sync (service, TRUE, cancellable, &local_error);
+ }
+ }
+
if (local_error != NULL)
g_propagate_error (error, local_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]