From 320f07f6312723d8365a02465d36c88dd442ee90 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 15 May 2008 12:03:05 +0200 Subject: [PATCH] Show stats on error during update detection too. --- src/csync.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/csync.c b/src/csync.c index 08b3baf051..9d9f8f7793 100644 --- a/src/csync.c +++ b/src/csync.c @@ -280,6 +280,7 @@ out: } int csync_update(CSYNC *ctx) { + int rc = -1; time_t start, finish; if (ctx == NULL) { @@ -289,12 +290,13 @@ int csync_update(CSYNC *ctx) { csync_memstat_check(); + /* update detection for local replica */ time(&start); ctx->current = LOCAL_REPLICA; ctx->replica = ctx->local.type; - if (csync_ftw(ctx, ctx->local.uri, csync_walker, MAX_DEPTH) < 0) { - return -1; - } + + rc = csync_ftw(ctx, ctx->local.uri, csync_walker, MAX_DEPTH); + time(&finish); CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Update detection for local replica took %.2f seconds", @@ -303,13 +305,19 @@ int csync_update(CSYNC *ctx) { "Collected files: %lu", c_rbtree_size(ctx->local.tree)); csync_memstat_check(); + if (rc < 0) { + return -1; + } + + /* update detection for remote replica */ time(&start); ctx->current = REMOTE_REPLCIA; ctx->replica = ctx->remote.type; - if (csync_ftw(ctx, ctx->remote.uri, csync_walker, MAX_DEPTH) < 0) { - return -1; - } + + rc = csync_ftw(ctx, ctx->remote.uri, csync_walker, MAX_DEPTH); + time(&finish); + CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Update detection for remote replica took %.2f seconds", difftime(finish, start)); @@ -317,6 +325,10 @@ int csync_update(CSYNC *ctx) { "Collected files: %lu", c_rbtree_size(ctx->remote.tree)); csync_memstat_check(); + if (rc < 0) { + return -1; + } + ctx->status |= CSYNC_UPDATE; return 0;