[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22488 - gnunet/src/namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22488 - gnunet/src/namestore |
Date: |
Thu, 5 Jul 2012 09:57:40 +0200 |
Author: grothoff
Date: 2012-07-05 09:57:40 +0200 (Thu, 05 Jul 2012)
New Revision: 22488
Modified:
gnunet/src/namestore/namestore_common.c
Log:
LRN: More logging for namespace comparison:
Changes GNUNET_NAMESTORE_records_cmp from a simple if statement to a
chain of if statements, each of which will log the reason comparison
failed before returning FALSE, making it obvious why comparison failed.
Modified: gnunet/src/namestore/namestore_common.c
===================================================================
--- gnunet/src/namestore/namestore_common.c 2012-07-04 19:24:57 UTC (rev
22487)
+++ gnunet/src/namestore/namestore_common.c 2012-07-05 07:57:40 UTC (rev
22488)
@@ -170,14 +170,44 @@
GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
const struct GNUNET_NAMESTORE_RecordData *b)
{
- if ((a->record_type == b->record_type) &&
- (a->expiration_time == b->expiration_time) &&
- ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)
- == (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS) ) &&
- (a->data_size == b->data_size) &&
- (0 == memcmp (a->data, b->data, a->data_size)))
- return GNUNET_YES;
- return GNUNET_NO;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Comparing records\n");
+ if (a->record_type != b->record_type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Record type %lu != %lu\n", a->record_type, b->record_type);
+ return GNUNET_NO;
+ }
+ if (a->expiration_time != b->expiration_time)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Expiration time %llu != %llu\n", a->expiration_time,
b->expiration_time);
+ return GNUNET_NO;
+ }
+ if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)
+ != (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Flags %lu (%lu) != %lu (%lu)\n", a->flags,
+ a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS, b->flags,
+ b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS);
+ return GNUNET_NO;
+ }
+ if (a->data_size != b->data_size)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Data size %lu != %lu\n", a->data_size, b->data_size);
+ return GNUNET_NO;
+ }
+ if (0 != memcmp (a->data, b->data, a->data_size))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Data contents do not match\n");
+ return GNUNET_NO;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Records are equal\n");
+ return GNUNET_YES;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22488 - gnunet/src/namestore,
gnunet <=