aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-service-namestore.c
diff options
context:
space:
mode:
authorwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-03-21 17:22:21 +0000
committerwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-03-21 17:22:21 +0000
commit34ce0e5279de138d2ad29ef820ce3d0881489d8d (patch)
tree56610e6595478109af1d35a90c7d1f82d0720c1c /src/namestore/gnunet-service-namestore.c
parentc19683af8394fcb87bde23065607249800105abd (diff)
- remove name if no rec is left
git-svn-id: https://gnunet.org/svn/gnunet@20663 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r--src/namestore/gnunet-service-namestore.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 5647dd3115..493d1f5744 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];