*/
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)
};
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;
uint32_t rid;
struct RemoveRecordContext rrc;
int res;
+ uint64_t off;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s' message\n",
"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;
{
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;