aboutsummaryrefslogtreecommitdiff
path: root/src/gns
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-20 18:02:39 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-20 18:02:39 +0000
commit0380fddde67fd46e9e5a201121f3c38ba15f6ccd (patch)
tree00d23fe73f2fdbd4f116d495123d39ca7319f793 /src/gns
parentc1ff578c693e4e45125ead915dc515bb141883ec (diff)
downloadgnunet-0380fddde67fd46e9e5a201121f3c38ba15f6ccd.tar.gz
gnunet-0380fddde67fd46e9e5a201121f3c38ba15f6ccd.zip
-simplify to use new namestore API to skip initial iteration, document now passing quickupdate test better
Diffstat (limited to 'src/gns')
-rw-r--r--src/gns/gnunet-service-gns.c24
-rwxr-xr-xsrc/gns/test_gns_quickupdate.sh12
2 files changed, 20 insertions, 16 deletions
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
@@ -236,15 +236,6 @@ static int v6_enabled;
236static int v4_enabled; 236static int v4_enabled;
237 237
238/** 238/**
239 * Did we finish the initial iteration over the namestore?
240 * (while we do the initial iteration, we do not generate
241 * DHT PUTs as there might be WAY too many of those).
242 * TODO: expand namestore monitor API with a way to
243 * suppress this initial iteration.
244 */
245static int sync_finished;
246
247/**
248 * Handle to the statistics service 239 * Handle to the statistics service
249 */ 240 */
250static struct GNUNET_STATISTICS_Handle *statistics; 241static struct GNUNET_STATISTICS_Handle *statistics;
@@ -485,8 +476,9 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
485 label, 476 label,
486 &query); 477 &query);
487 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
488 "Storing record in DHT with expiration `%s'\n", 479 "Storing record in DHT with expiration `%s' under key %s\n",
489 GNUNET_STRINGS_absolute_time_to_string (expire)); 480 GNUNET_STRINGS_absolute_time_to_string (expire),
481 GNUNET_h2s (&query));
490 ret = GNUNET_DHT_put (dht_handle, &query, 482 ret = GNUNET_DHT_put (dht_handle, &query,
491 DHT_GNS_REPLICATION_LEVEL, 483 DHT_GNS_REPLICATION_LEVEL,
492 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, 484 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
@@ -646,9 +638,10 @@ handle_monitor_event (void *cls,
646 unsigned int rd_public_count; 638 unsigned int rd_public_count;
647 struct MonitorActivity *ma; 639 struct MonitorActivity *ma;
648 640
649 if (GNUNET_YES != sync_finished) 641 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
650 return; /* do not do DHT PUTs on initial sync, as that may 642 "Received %u records for label `%s' via namestore monitor\n",
651 create far too many PUTs on startup */ 643 rd_count,
644 label);
652 /* filter out records that are not public, and convert to 645 /* filter out records that are not public, and convert to
653 absolute expiration time. */ 646 absolute expiration time. */
654 rd_public_count = convert_records_for_export (rd, rd_count, 647 rd_public_count = convert_records_for_export (rd, rd_count,
@@ -833,7 +826,6 @@ notify_client_disconnect (void *cls,
833static void 826static void
834monitor_sync_event (void *cls) 827monitor_sync_event (void *cls)
835{ 828{
836 sync_finished = GNUNET_YES;
837 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, 829 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start,
838 NULL); 830 NULL);
839} 831}
@@ -955,9 +947,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
955 nc = GNUNET_SERVER_notification_context_create (server, 1); 947 nc = GNUNET_SERVER_notification_context_create (server, 1);
956 zmon = GNUNET_NAMESTORE_zone_monitor_start (c, 948 zmon = GNUNET_NAMESTORE_zone_monitor_start (c,
957 NULL, 949 NULL,
950 GNUNET_NO,
958 &handle_monitor_event, 951 &handle_monitor_event,
959 &monitor_sync_event, 952 &monitor_sync_event,
960 NULL); 953 NULL);
954 GNUNET_break (NULL != zmon);
961 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 955 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
962 &shutdown_task, NULL); 956 &shutdown_task, NULL);
963} 957}
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
9DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') 9DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
10gnunet-arm -i gns -c test_gns_lookup.conf 10gnunet-arm -i gns -c test_gns_lookup.conf
11gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf 11gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
12sleep 5 12# Give GNS/namestore time to fully start and finish initial iteration
13sleep 2
14# Performing namestore update
13gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf 15gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
16# Give GNS chance to observe store event via monitor
17sleep 1
14gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf 18gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
19# give GNS chance to process monitor event
20sleep 1
21# stop everything and restart to check that DHT PUT did happen
15gnunet-arm -k gns -c test_gns_lookup.conf 22gnunet-arm -k gns -c test_gns_lookup.conf
16gnunet-arm -k namestore -c test_gns_lookup.conf 23gnunet-arm -k namestore -c test_gns_lookup.conf
17gnunet-arm -k namecache -c test_gns_lookup.conf 24gnunet-arm -k namecache -c test_gns_lookup.conf
25# Purge nameacache, as we might otherwise fetch from there
18rm -r `gnunet-config -c test_gns_lookup.conf -s namecache-sqlite -o FILENAME` 26rm -r `gnunet-config -c test_gns_lookup.conf -s namecache-sqlite -o FILENAME`
27gnunet-arm -i namestore -c test_gns_lookup.conf
28gnunet-arm -i namecache -c test_gns_lookup.conf
19gnunet-arm -i gns -c test_gns_lookup.conf 29gnunet-arm -i gns -c test_gns_lookup.conf
20RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` 30RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf`
21gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf 31gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf