[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22465 - in gnunet/src: include namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22465 - in gnunet/src: include namestore |
Date: |
Tue, 3 Jul 2012 21:15:16 +0200 |
Author: grothoff
Date: 2012-07-03 21:15:15 +0200 (Tue, 03 Jul 2012)
New Revision: 22465
Modified:
gnunet/src/include/gnunet_namestore_service.h
gnunet/src/namestore/gnunet-service-namestore.c
gnunet/src/namestore/namestore_common.c
Log:
-fix gns record deletion
Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h 2012-07-03 17:42:47 UTC
(rev 22464)
+++ gnunet/src/include/gnunet_namestore_service.h 2012-07-03 19:15:15 UTC
(rev 22465)
@@ -170,6 +170,18 @@
*/
GNUNET_NAMESTORE_RF_SHADOW_RECORD = 16
+ /**
+ * When comparing flags for record equality for removal,
+ * which flags should must match (in addition to the type,
+ * name, expiration value and data of the record)? All flags
+ * that are not listed here will be ignored for this purpose.
+ * (for example, we don't expect that users will remember to
+ * pass the '--private' option when removing a record from
+ * the namestore, hence we don't require this particular option
+ * to match upon removal). See also
+ * 'GNUNET_NAMESTORE_records_cmp'.
+ */
+#define GNUNET_NAMESTORE_RF_RCMP_FLAGS
(GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)
};
Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c 2012-07-03 17:42:47 UTC
(rev 22464)
+++ gnunet/src/namestore/gnunet-service-namestore.c 2012-07-03 19:15:15 UTC
(rev 22465)
@@ -1280,15 +1280,13 @@
rrc->op_res = RECORD_REMOVE_RESULT_NO_RECORDS;
return;
}
-
/* Find record to remove */
found = -1;
for (c = 0; c < rd_count; c++)
{
- if ( (rd[c].flags != rrc->rd->flags) ||
- (rd[c].record_type != rrc->rd->record_type) ||
- (rd[c].data_size != rrc->rd->data_size) ||
- (0 != memcmp (rd[c].data, rrc->rd->data, rrc->rd->data_size)) )
+ if (GNUNET_YES !=
+ GNUNET_NAMESTORE_records_cmp (&rd[c],
+ rrc->rd))
continue;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found record to remove!\n",
rd_count);
found = c;
@@ -1379,6 +1377,7 @@
uint32_t rid;
struct RemoveRecordContext rrc;
int res;
+ uint64_t off;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s' message\n",
@@ -1465,18 +1464,28 @@
"Removing record for name `%s' in zone `%s'\n", name_tmp,
GNUNET_short_h2s (&pubkey_hash));
rrc.rd = &rd;
- res = GSN_database->iterate_records (GSN_database->cls,
- &pubkey_hash,
- name_tmp,
- 0,
- handle_record_remove_it, &rrc);
+ rrc.op_res = RECORD_REMOVE_RESULT_RECORD_NOT_FOUND;
+ off = 0;
+ res = GNUNET_OK;
+ while ( (RECORD_REMOVE_RESULT_RECORD_NOT_FOUND == rrc.op_res) &&
+ (GNUNET_OK == res) )
+ {
+ res = GSN_database->iterate_records (GSN_database->cls,
+ &pubkey_hash,
+ name_tmp,
+ off++,
+ &handle_record_remove_it, &rrc);
+ }
switch (res)
{
case GNUNET_OK:
res = rrc.op_res;
break;
case GNUNET_NO:
+ GNUNET_break (RECORD_REMOVE_RESULT_NO_RECORDS == rrc.op_res);
res = RECORD_REMOVE_RESULT_NO_RECORDS;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Failed to find record to remove\n"));
break;
case GNUNET_SYSERR:
res = RECORD_REMOVE_RESULT_FAILED_ACCESS_DATABASE;
Modified: gnunet/src/namestore/namestore_common.c
===================================================================
--- gnunet/src/namestore/namestore_common.c 2012-07-03 17:42:47 UTC (rev
22464)
+++ gnunet/src/namestore/namestore_common.c 2012-07-03 19:15:15 UTC (rev
22465)
@@ -172,8 +172,8 @@
{
if ((a->record_type == b->record_type) &&
(a->expiration_time == b->expiration_time) &&
- ((a->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)
- == (b->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION) ) &&
+ ((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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22465 - in gnunet/src: include namestore,
gnunet <=