dovecot-2.0: dsync proxy client: Improved error handling.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Oct 29 19:59:38 EET 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/89d924850fb1
changeset: 10227:89d924850fb1
user: Timo Sirainen <tss at iki.fi>
date: Thu Oct 29 13:59:30 2009 -0400
description:
dsync proxy client: Improved error handling.
diffstat:
1 file changed, 15 insertions(+), 1 deletion(-)
src/dsync/dsync-proxy-client.c | 16 +++++++++++++++-
diffs (47 lines):
diff -r e5bd42b8c2f0 -r 89d924850fb1 src/dsync/dsync-proxy-client.c
--- a/src/dsync/dsync-proxy-client.c Thu Oct 29 13:59:11 2009 -0400
+++ b/src/dsync/dsync-proxy-client.c Thu Oct 29 13:59:30 2009 -0400
@@ -9,6 +9,7 @@
#include "ostream.h"
#include "str.h"
#include "strescape.h"
+#include "master-service.h"
#include "imap-util.h"
#include "dsync-proxy.h"
#include "dsync-worker-private.h"
@@ -64,6 +65,13 @@ extern struct dsync_worker_vfuncs proxy_
static void proxy_client_worker_input(struct proxy_client_dsync_worker *worker);
static void proxy_client_send_stream(struct proxy_client_dsync_worker *worker);
+
+static void proxy_client_fail(struct proxy_client_dsync_worker *worker)
+{
+ i_stream_close(worker->input);
+ dsync_worker_set_failure(&worker->worker);
+ master_service_stop(master_service);
+}
static int
proxy_client_worker_read_line(struct proxy_client_dsync_worker *worker,
@@ -125,7 +133,7 @@ proxy_client_worker_next_msg_get(struct
line, &worker->msg_get_data,
&error) < 0) {
i_error("Invalid msg-get static input: %s", error);
- i_stream_close(worker->input);
+ proxy_client_fail(worker);
return FALSE;
}
worker->msg_get_data.input =
@@ -165,6 +173,12 @@ proxy_client_worker_next_reply(struct pr
struct proxy_client_request request;
bool ret = TRUE;
+ if (aqueue_count(worker->request_queue) == 0) {
+ i_error("Unexpected reply from server: %s", line);
+ proxy_client_fail(worker);
+ return FALSE;
+ }
+
requests = array_idx(&worker->request_array, 0);
request = requests[aqueue_idx(worker->request_queue, 0)];
aqueue_delete_tail(worker->request_queue);
More information about the dovecot-cvs
mailing list