From 88652b999ab006d0e863234395415edcbcddfbfe Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 2 Oct 2013 11:40:00 +0000 Subject: -delete does not work in the strong sense due to caching of the encrypted blocks, adjusting tests to reflect this --- src/namestore/gnunet-service-namestore.c | 7 +++++-- src/namestore/plugin_namestore_sqlite.c | 5 ++++- src/namestore/test_namestore_api_remove.c | 21 +++------------------ src/namestore/test_namestore_delete.sh | 4 ++-- 4 files changed, 14 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 1a675cb1f..4c64dcd29 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -646,8 +646,11 @@ handle_record_store (void *cls, if ((rd_count == 0) && (GNUNET_NO == GSN_database->iterate_records (GSN_database->cls, &rp_msg->private_key, 0, NULL, 0))) { - /* This name does not exist, so cannot be removed */ - res = GNUNET_NO; + /* This name does not exist, so cannot be removed */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Name `%s' does not exist, no deletion required\n", + conv_name); + res = GNUNET_NO; } else { diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index f2f884290..4c040cc97 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c @@ -695,7 +695,10 @@ namestore_sqlite_store_records (void *cls, switch (n) { case SQLITE_DONE: - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Record stored\n"); + if (0 != rd_count) + GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Record stored\n"); + else + GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Record deleted\n"); return GNUNET_OK; case SQLITE_BUSY: LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 4c83cda63..568a0cd8b 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c @@ -94,16 +94,12 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) res = 0; } -static void -name_lookup_proc (void *cls, const struct GNUNET_NAMESTORE_Block *block); - static void remove_cont (void *cls, int32_t success, const char *emsg) { - const char *name = cls; if (GNUNET_YES != success) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -113,23 +109,12 @@ remove_cont (void *cls, endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Records were removed, perform lookup\n"); - removed = GNUNET_YES; - nsqe = GNUNET_NAMESTORE_lookup_block (nsh, &derived_hash, - &name_lookup_proc, (void *) name); - if (NULL == nsqe) - { - GNUNET_break (0); - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Namestore cannot perform lookup for removed record\n")); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) - GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); - return; - } + if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + GNUNET_SCHEDULER_cancel (endbadly_task); + GNUNET_SCHEDULER_add_now (&end, NULL); } diff --git a/src/namestore/test_namestore_delete.sh b/src/namestore/test_namestore_delete.sh index 2b39bbd28..7e5ca97e7 100755 --- a/src/namestore/test_namestore_delete.sh +++ b/src/namestore/test_namestore_delete.sh @@ -32,8 +32,8 @@ start_peer gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION # Delete record gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION -# Lookup specific name -OUTPUT=`gnunet-namestore -p -z testego -n $TEST_RECORD_NAME_DNS -D` +# List all records +OUTPUT=`gnunet-namestore -p -z testego -D` FOUND_IP=false FOUND_NAME=false for LINE in $OUTPUT ; -- cgit v1.2.3