aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-07-08 19:00:34 +0800
committerMilan Crha <mcrha@redhat.com>2014-07-08 19:00:34 +0800
commit28391aa9253135c92228b7c6ebd49268e23acdee (patch)
treedf6368e7675d29e35bd6f3174c5b3f2a2427e7a4
parente837eb24ea6ae6bcd4d9fc3d6aaa852fe7112fff (diff)
downloadgsoc2013-evolution-28391aa9253135c92228b7c6ebd49268e23acdee.tar
gsoc2013-evolution-28391aa9253135c92228b7c6ebd49268e23acdee.tar.gz
gsoc2013-evolution-28391aa9253135c92228b7c6ebd49268e23acdee.tar.bz2
gsoc2013-evolution-28391aa9253135c92228b7c6ebd49268e23acdee.tar.lz
gsoc2013-evolution-28391aa9253135c92228b7c6ebd49268e23acdee.tar.xz
gsoc2013-evolution-28391aa9253135c92228b7c6ebd49268e23acdee.tar.zst
gsoc2013-evolution-28391aa9253135c92228b7c6ebd49268e23acdee.zip
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.
-rw-r--r--libemail-engine/mail-ops.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c
index 67fc5a9742..c12555ff5d 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);