From f9875dc6b4b3ff08467aae0404248f1763377239 Mon Sep 17 00:00:00 2001 From: Evgeniy Polyakov Date: Wed, 14 Nov 2012 20:25:56 +0400 Subject: [PATCH] Minor cleanups --- cache/cache.cpp | 3 ++- library/dnet.c | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cache/cache.cpp b/cache/cache.cpp index cecb078..82cda2e 100644 --- a/cache/cache.cpp +++ b/cache/cache.cpp @@ -339,8 +339,9 @@ int dnet_cmd_cache_io(struct dnet_net_state *st, struct dnet_cmd *cmd, struct dn case DNET_CMD_WRITE: if (io->flags & DNET_IO_FLAGS_COMPARE_AND_SWAP) { d = cache->read(io->id); + dnet_id csum; - dnet_transform(n, &(d->data().front()), d->data().size(), &csum); + dnet_transform(n, d->data().data(), d->data().size(), &csum); if (!memcmp(csum.id, io->parent, DNET_ID_SIZE)) { err = -EINVAL; diff --git a/library/dnet.c b/library/dnet.c index 5ef924e..edcec25 100644 --- a/library/dnet.c +++ b/library/dnet.c @@ -646,17 +646,16 @@ int dnet_process_cmd_raw(struct dnet_net_state *st, struct dnet_cmd *cmd, void * if (io->flags & DNET_IO_FLAGS_COMPARE_AND_SWAP) { char csum[DNET_ID_SIZE]; int csize = DNET_ID_SIZE; - err = n->cb->checksum(n, n->cb->command_private, &(cmd->id), csum, &csize); + + err = n->cb->checksum(n, n->cb->command_private, &cmd->id, csum, &csize); if (err < 0) { - dnet_log(n, DNET_LOG_INFO, "checksum failed\n"); + dnet_log(n, DNET_LOG_ERROR, "%s: cas: checksum operation failed\n", dnet_dump_id(&cmd->id)); err = 0; } else { if (memcmp(csum, io->parent, DNET_ID_SIZE)) { - dnet_log(n, DNET_LOG_INFO, "wrong csum\n"); + dnet_log(n, DNET_LOG_ERROR, "%s: cas: checksum mismatch\n", dnet_dump_id(&cmd->id)); err = -EINVAL; break; - } else { - dnet_log(n, DNET_LOG_INFO, "csums equals\n"); } } } -- 2.11.4.GIT