Mercurial > dovecot > core-2.2
changeset 10219:55b60c79c54c HEAD
dsync: Check for errors when saving messages.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 28 Oct 2009 17:04:24 -0400 |
parents | eb9a262fde74 |
children | a90d9bb6fec3 |
files | src/dsync/dsync-proxy-server-cmd.c src/dsync/dsync-worker.c src/dsync/dsync-worker.h |
diffstat | 3 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dsync/dsync-proxy-server-cmd.c Wed Oct 28 17:02:01 2009 -0400 +++ b/src/dsync/dsync-proxy-server-cmd.c Wed Oct 28 17:04:24 2009 -0400 @@ -282,6 +282,7 @@ struct dsync_message msg; struct dsync_msg_static_data data; const char *error; + int ret; if (dsync_proxy_msg_static_import_unescaped(pool_datastack_create(), args, &data, &error) < 0) { @@ -300,9 +301,10 @@ net_set_nonblock(server->fd_in, FALSE); dsync_worker_msg_save(server->worker, &msg, &data); net_set_nonblock(server->fd_in, TRUE); - i_assert(data.input->eof); + ret = dsync_worker_has_failed(server->worker) ? -1 : 1; + i_assert(data.input->eof || ret < 0); i_stream_destroy(&data.input); - return 1; + return ret; } static void cmd_msg_get_send_more(struct dsync_proxy_server *server)
--- a/src/dsync/dsync-worker.c Wed Oct 28 17:02:01 2009 -0400 +++ b/src/dsync/dsync-worker.c Wed Oct 28 17:04:24 2009 -0400 @@ -184,3 +184,8 @@ { worker->failed = TRUE; } + +bool dsync_worker_has_failed(struct dsync_worker *worker) +{ + return worker->failed; +}
--- a/src/dsync/dsync-worker.h Wed Oct 28 17:02:01 2009 -0400 +++ b/src/dsync/dsync-worker.h Wed Oct 28 17:04:24 2009 -0400 @@ -113,4 +113,7 @@ dsync_worker_finish_callback_t *callback, void *context); +/* Returns TRUE if some commands have failed. */ +bool dsync_worker_has_failed(struct dsync_worker *worker); + #endif