From 0380fddde67fd46e9e5a201121f3c38ba15f6ccd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 20 Oct 2013 18:02:39 +0000 Subject: -simplify to use new namestore API to skip initial iteration, document now passing quickupdate test better --- src/gns/gnunet-service-gns.c | 24 +++++++++--------------- src/gns/test_gns_quickupdate.sh | 12 +++++++++++- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'src/gns') diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index ca2e80fd0..530318808 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c @@ -235,15 +235,6 @@ static int v6_enabled; */ static int v4_enabled; -/** - * Did we finish the initial iteration over the namestore? - * (while we do the initial iteration, we do not generate - * DHT PUTs as there might be WAY too many of those). - * TODO: expand namestore monitor API with a way to - * suppress this initial iteration. - */ -static int sync_finished; - /** * Handle to the statistics service */ @@ -485,8 +476,9 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, label, &query); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Storing record in DHT with expiration `%s'\n", - GNUNET_STRINGS_absolute_time_to_string (expire)); + "Storing record in DHT with expiration `%s' under key %s\n", + GNUNET_STRINGS_absolute_time_to_string (expire), + GNUNET_h2s (&query)); ret = GNUNET_DHT_put (dht_handle, &query, DHT_GNS_REPLICATION_LEVEL, GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, @@ -646,9 +638,10 @@ handle_monitor_event (void *cls, unsigned int rd_public_count; struct MonitorActivity *ma; - if (GNUNET_YES != sync_finished) - return; /* do not do DHT PUTs on initial sync, as that may - create far too many PUTs on startup */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received %u records for label `%s' via namestore monitor\n", + rd_count, + label); /* filter out records that are not public, and convert to absolute expiration time. */ rd_public_count = convert_records_for_export (rd, rd_count, @@ -833,7 +826,6 @@ notify_client_disconnect (void *cls, static void monitor_sync_event (void *cls) { - sync_finished = GNUNET_YES; zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, NULL); } @@ -955,9 +947,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, nc = GNUNET_SERVER_notification_context_create (server, 1); zmon = GNUNET_NAMESTORE_zone_monitor_start (c, NULL, + GNUNET_NO, &handle_monitor_event, &monitor_sync_event, NULL); + GNUNET_break (NULL != zmon); GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); } diff --git a/src/gns/test_gns_quickupdate.sh b/src/gns/test_gns_quickupdate.sh index 001e89a73..84882a70b 100755 --- a/src/gns/test_gns_quickupdate.sh +++ b/src/gns/test_gns_quickupdate.sh @@ -9,13 +9,23 @@ gnunet-identity -C delegatedego -c test_gns_lookup.conf DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') gnunet-arm -i gns -c test_gns_lookup.conf gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf -sleep 5 +# Give GNS/namestore time to fully start and finish initial iteration +sleep 2 +# Performing namestore update gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf +# Give GNS chance to observe store event via monitor +sleep 1 gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf +# give GNS chance to process monitor event +sleep 1 +# stop everything and restart to check that DHT PUT did happen gnunet-arm -k gns -c test_gns_lookup.conf gnunet-arm -k namestore -c test_gns_lookup.conf gnunet-arm -k namecache -c test_gns_lookup.conf +# Purge nameacache, as we might otherwise fetch from there rm -r `gnunet-config -c test_gns_lookup.conf -s namecache-sqlite -o FILENAME` +gnunet-arm -i namestore -c test_gns_lookup.conf +gnunet-arm -i namecache -c test_gns_lookup.conf gnunet-arm -i gns -c test_gns_lookup.conf RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf -- cgit v1.2.3