[evolution-data-server] [NNTP] Can fail to disconnect when the command was cancelled
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [NNTP] Can fail to disconnect when the command was cancelled
- Date: Fri, 24 Apr 2015 10:43:12 +0000 (UTC)
commit f5acd63289ae7995284601a3a8d53fc2b849ef54
Author: Milan Crha <mcrha redhat com>
Date: Fri Apr 24 12:41:02 2015 +0200
[NNTP] Can fail to disconnect when the command was cancelled
There was used already cancelled cancellable for the service
disconnect, which could succeed, but as the cancellable was
cancelled the overall operation failed and the NNTP store was
left in the 'connected' state, even with no nntp_stream set.
camel/providers/nntp/camel-nntp-store.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index adce087..0466719 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -2208,15 +2208,25 @@ camel_nntp_command (CamelNNTPStore *nntp_store,
case 400: /* service discontinued */
case 401: /* wrong client state - this should quit but this is what the old code did */
case 503: /* information not available - this should quit but this is what the old code
did (?) */
- if (camel_service_get_connection_status (service) != CAMEL_SERVICE_CONNECTING)
+ if (camel_service_get_connection_status (service) != CAMEL_SERVICE_CONNECTING) {
+ /* Reset the cancellable, thus the disconnect attempt can succeed. */
+ if (g_cancellable_is_cancelled (cancellable))
+ g_cancellable_reset (cancellable);
+
camel_service_disconnect_sync (
service, FALSE, cancellable, NULL);
+ }
ret = -1;
continue;
case -1: /* i/o error */
- if (camel_service_get_connection_status (service) != CAMEL_SERVICE_CONNECTING)
+ if (camel_service_get_connection_status (service) != CAMEL_SERVICE_CONNECTING) {
+ /* Reset the cancellable, thus the disconnect attempt can succeed. */
+ if (g_cancellable_is_cancelled (cancellable))
+ g_cancellable_reset (cancellable);
+
camel_service_disconnect_sync (
service, FALSE, cancellable, NULL);
+ }
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || retry >= 3) {
g_propagate_error (error, local_error);
ret = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]