From: Timo Sirainen Date: Fri, 16 Jul 2010 14:45:10 +0000 (+0100) Subject: dsync: Fixed a potential assert-crash with remote dsyncing. X-Git-Tag: 2.0.rc3~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ce04b0c19e2864592a433ae1004f4d4bd0ee161e;p=thirdparty%2Fdovecot%2Fcore.git dsync: Fixed a potential assert-crash with remote dsyncing. (worker->msg_get_data.input == NULL) --- diff --git a/src/dsync/dsync-proxy-client.c b/src/dsync/dsync-proxy-client.c index 6aad2ac939..aa073fff08 100644 --- a/src/dsync/dsync-proxy-client.c +++ b/src/dsync/dsync-proxy-client.c @@ -121,13 +121,6 @@ proxy_client_worker_read_line(struct proxy_client_dsync_worker *worker, return 1; } -static void -proxy_client_worker_timeout_input(struct proxy_client_dsync_worker *worker) -{ - timeout_remove(&worker->to_input); - proxy_client_worker_input(worker); -} - static void proxy_client_worker_msg_get_done(struct proxy_client_dsync_worker *worker) { @@ -149,8 +142,7 @@ proxy_client_worker_msg_get_done(struct proxy_client_dsync_worker *worker) /* some input may already be buffered */ if (worker->to_input == NULL) { worker->to_input = - timeout_add(0, proxy_client_worker_timeout_input, - worker); + timeout_add(0, proxy_client_worker_input, worker); } } @@ -192,7 +184,6 @@ proxy_client_worker_next_msg_get(struct proxy_client_dsync_worker *worker, const char *p, *error; uint32_t uid; - i_assert(worker->msg_get_data.input == NULL); p_clear(worker->msg_get_pool); switch (line[0]) { case '1': @@ -274,6 +265,8 @@ proxy_client_worker_next_reply(struct proxy_client_dsync_worker *worker, struct proxy_client_request request; bool ret = TRUE; + i_assert(worker->msg_get_data.input == NULL); + if (aqueue_count(worker->request_queue) == 0) { i_error("Unexpected reply from server: %s", line); proxy_client_fail(worker); @@ -303,6 +296,9 @@ static void proxy_client_worker_input(struct proxy_client_dsync_worker *worker) const char *line; int ret; + if (worker->to_input != NULL) + timeout_remove(&worker->to_input); + timeout_reset(worker->to); if (worker->worker.input_callback != NULL) { worker->worker.input_callback(worker->worker.input_context);