int csync_propagate(CSYNC *ctx) { int rc = -1; struct timespec start, finish; if (ctx == NULL) { errno = EBADF; return -1; } ctx->error_code = CSYNC_ERR_NONE; /* Reconciliation for local replica */ csync_gettime(&start); ctx->current = LOCAL_REPLICA; ctx->replica = ctx->local.type; rc = csync_propagate_files(ctx); csync_gettime(&finish); CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Propagation for local replica took %.2f seconds visiting %zu files.", c_secdiff(finish, start), c_rbtree_size(ctx->local.tree)); if (rc < 0) { ctx->error_code = CSYNC_ERR_PROPAGATE; return -1; } /* Reconciliation for local replica */ csync_gettime(&start); ctx->current = REMOTE_REPLCIA; ctx->replica = ctx->remote.type; rc = csync_propagate_files(ctx); csync_gettime(&finish); CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Propagation for remote replica took %.2f seconds visiting %zu files.", c_secdiff(finish, start), c_rbtree_size(ctx->remote.tree)); if (rc < 0) { ctx->error_code = CSYNC_ERR_PROPAGATE; return -1; } ctx->status |= CSYNC_STATUS_PROPAGATE; return 0; }
int csync_propagate(CSYNC *ctx) { int rc = -1; struct timespec start, finish; if (ctx == NULL) { errno = EBADF; return -1; } ctx->status_code = CSYNC_STATUS_OK; /* Initialize the database for the overall progress callback. */ rc = csync_init_overall_progress(ctx); if (rc < 0) { if (ctx->status_code == CSYNC_STATUS_OK) { ctx->status_code = CSYNC_STATUS_PROPAGATE_ERROR; } return -1; } /* Reconciliation for local replica */ csync_gettime(&start); ctx->current = LOCAL_REPLICA; ctx->replica = ctx->local.type; rc = csync_propagate_files(ctx); csync_gettime(&finish); CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Propagation for local replica took %.2f seconds visiting %zu files.", c_secdiff(finish, start), c_rbtree_size(ctx->local.tree)); if (rc < 0) { if (!CSYNC_STATUS_IS_OK(ctx->status_code)) { ctx->status_code = CSYNC_STATUS_PROPAGATE_ERROR; } return -1; } /* Reconciliation for local replica */ csync_gettime(&start); ctx->current = REMOTE_REPLICA; ctx->replica = ctx->remote.type; rc = csync_propagate_files(ctx); csync_gettime(&finish); CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Propagation for remote replica took %.2f seconds visiting %zu files.", c_secdiff(finish, start), c_rbtree_size(ctx->remote.tree)); if (rc < 0) { if (!CSYNC_STATUS_IS_OK(ctx->status_code)) { ctx->status_code = CSYNC_STATUS_PROPAGATE_ERROR; } return -1; } ctx->status |= CSYNC_STATUS_PROPAGATE; return 0; }