]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Fixed a potential assert-crash with remote dsyncing.
authorTimo Sirainen <tss@iki.fi>
Fri, 16 Jul 2010 14:45:10 +0000 (15:45 +0100)
committerTimo Sirainen <tss@iki.fi>
Fri, 16 Jul 2010 14:45:10 +0000 (15:45 +0100)
(worker->msg_get_data.input == NULL)

src/dsync/dsync-proxy-client.c

index 6aad2ac93961ec11804a5d3d74f5a256225f7024..aa073fff08915f433a1ca70754aaf1384c37ee1a 100644 (file)
@@ -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);