[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30236 - gnunet-gtk/src/namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30236 - gnunet-gtk/src/namestore |
Date: |
Wed, 16 Oct 2013 23:03:53 +0200 |
Author: grothoff
Date: 2013-10-16 23:03:53 +0200 (Wed, 16 Oct 2013)
New Revision: 30236
Modified:
gnunet-gtk/src/namestore/gnunet-namestore-gtk.c
Log:
-use iterator, instead of relying on blocks
Modified: gnunet-gtk/src/namestore/gnunet-namestore-gtk.c
===================================================================
--- gnunet-gtk/src/namestore/gnunet-namestore-gtk.c 2013-10-16 20:29:10 UTC
(rev 30235)
+++ gnunet-gtk/src/namestore/gnunet-namestore-gtk.c 2013-10-16 21:03:53 UTC
(rev 30236)
@@ -225,7 +225,7 @@
/**
* Associated namestore operation.
*/
- struct GNUNET_NAMESTORE_QueueEntry *qe;
+ struct GNUNET_NAMESTORE_ZoneIterator *it;
/**
* Info from editing dialog.
@@ -842,36 +842,35 @@
* merging.
*
* @param cls closure with the `struct MoveOperationContext`
- * @param block block to decrypt
+ * @param zone private key of the zone; NULL on disconnect
+ * @param label label of the records; NULL on disconnect
+ * @param rd_count number of entries in @a rd array, 0 if label was deleted
+ * @param rd array of records with data to store
*/
static void
-decrypt_block_for_merge (void *cls,
- const struct GNUNET_GNSRECORD_Block *block)
+handle_records_for_merge (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ const char *label,
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
struct MoveOperationContext *moc = cls;
- struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
- if (NULL == block)
+ if (NULL == label)
{
+ moc->it = NULL;
merge_with_existing_records (moc, 0, NULL);
return;
}
- GNUNET_CRYPTO_ecdsa_key_get_public (&moc->pk,
- &pubkey);
- if (GNUNET_OK !=
- GNUNET_GNSRECORD_block_decrypt (block,
- &pubkey,
- moc->edc->name,
- &merge_with_existing_records,
- moc))
+ if (0 != strcmp (label,
+ moc->edc->name))
{
- show_error_message (_("Failed to decode existing record in target zone"),
- _("Failed to add new record."));
- GNUNET_free (moc->data);
- free_edit_dialog_context (moc->edc);
- GNUNET_free (moc);
+ GNUNET_NAMESTORE_zone_iterator_next (moc->it);
return;
}
+ GNUNET_NAMESTORE_zone_iteration_stop (moc->it);
+ moc->it = NULL;
+ merge_with_existing_records (moc, rd_count, rd);
}
@@ -1009,9 +1008,9 @@
moc->edc = edc;
moc->pk = *pk;
GNUNET_CONTAINER_DLL_insert (moc_head, moc_tail, moc);
- moc->qe = GNUNET_NAMESTORE_lookup_block (namestore,
- &query,
- &decrypt_block_for_merge,
+ moc->it = GNUNET_NAMESTORE_zone_iteration_start (namestore,
+ pk,
+
&handle_records_for_merge,
moc);
/* zone changed, remove record from old zone, add to new zone! */
if (GNUNET_YES == edc->old_record_in_namestore)
@@ -2072,7 +2071,8 @@
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("A pending namestore operation was not transmitted to the
namestore.\n"));
GNUNET_CONTAINER_DLL_remove (moc_head, moc_tail, moc);
- GNUNET_NAMESTORE_cancel (moc->qe);
+ if (NULL != moc->it)
+ GNUNET_NAMESTORE_zone_iteration_stop (moc->it);
free_edit_dialog_context (moc->edc);
GNUNET_free (moc->data);
GNUNET_free (moc);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30236 - gnunet-gtk/src/namestore,
gnunet <=