From 05f760855eafbfcfc1f99e290f8a1a28b399b686 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Wed, 21 Mar 2012 17:22:21 +0000 Subject: [PATCH] - remove name if no rec is left --- src/namestore/gnunet-service-namestore.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 5647dd311..493d1f574 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -985,6 +985,7 @@ struct RemoveRecordContext { struct GNUNET_NAMESTORE_RecordData *rd; struct GNUNET_CRYPTO_RsaPrivateKey *pkey; + int remove_name; uint16_t op_res; }; @@ -1046,6 +1047,26 @@ handle_record_remove_it (void *cls, return; } + if (rd_count-1 == 0) + { + struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; + GNUNET_CRYPTO_short_hash (zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash); + res = GSN_database->remove_records (GSN_database->cls, + &pubkey_hash, + name); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "No records left for name `%s', removing name\n", + name, res); + if (GNUNET_OK != res) + { + /* Could put records into database */ + rrc->op_res = 4; + return; + } + rrc->op_res = 0; + return; + } + rd_count_new = rd_count -1; struct GNUNET_NAMESTORE_RecordData rd_new[rd_count_new]; -- 2.25.1