aboutsummaryrefslogtreecommitdiff
path: root/src/zonemaster
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-04-30 11:43:12 +0200
committerChristian Grothoff <christian@grothoff.org>2018-04-30 11:43:12 +0200
commite053a6c9a9b903d6bfbdfa64961f20a838e4f258 (patch)
treed2da0eedf700159e88bd558cccfc75881a5b8dcf /src/zonemaster
parentccf723196e9ff7f31a56a8e8ebd8319d07fa17c8 (diff)
downloadgnunet-e053a6c9a9b903d6bfbdfa64961f20a838e4f258.tar.gz
gnunet-e053a6c9a9b903d6bfbdfa64961f20a838e4f258.zip
calculate velocity on PUT instead of put confirmation, publish delay statistic
Diffstat (limited to 'src/zonemaster')
-rw-r--r--src/zonemaster/gnunet-service-zonemaster.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c
index c91c4b679..0f7e9f547 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -187,7 +187,7 @@ static unsigned long long last_num_public_records;
187 187
188/** 188/**
189 * Number of successful put operations performed in the current 189 * Number of successful put operations performed in the current
190 * measurement cycle (as measured in #check_zone_dht_next()). 190 * measurement cycle (as measured in #check_zone_namestore_next()).
191 */ 191 */
192static unsigned long long put_cnt; 192static unsigned long long put_cnt;
193 193
@@ -334,7 +334,7 @@ shutdown_task (void *cls)
334 * @param cls closure 334 * @param cls closure
335 */ 335 */
336static void 336static void
337publish_zone_dht_next (void *cls) 337publish_zone_namestore_next (void *cls)
338{ 338{
339 zone_publish_task = NULL; 339 zone_publish_task = NULL;
340 GNUNET_assert (NULL != namestore_iter); 340 GNUNET_assert (NULL != namestore_iter);
@@ -375,10 +375,10 @@ dht_put_monitor_continuation (void *cls)
375 375
376/** 376/**
377 * Check if the current zone iteration needs to be continued 377 * Check if the current zone iteration needs to be continued
378 * by calling #publish_zone_dht_next(), and if so with what delay. 378 * by calling #publish_zone_namestore_next(), and if so with what delay.
379 */ 379 */
380static void 380static void
381check_zone_dht_next () 381check_zone_namestore_next ()
382{ 382{
383 struct GNUNET_TIME_Relative delay; 383 struct GNUNET_TIME_Relative delay;
384 384
@@ -391,8 +391,12 @@ check_zone_dht_next ()
391 delay = GNUNET_TIME_relative_multiply (delay, 391 delay = GNUNET_TIME_relative_multiply (delay,
392 NS_BLOCK_SIZE); 392 NS_BLOCK_SIZE);
393 GNUNET_assert (NULL == zone_publish_task); 393 GNUNET_assert (NULL == zone_publish_task);
394 GNUNET_STATISTICS_set (statistics,
395 "Current artificial NAMESTORE delay (μs)",
396 delay.rel_value_us,
397 GNUNET_NO);
394 zone_publish_task = GNUNET_SCHEDULER_add_delayed (delay, 398 zone_publish_task = GNUNET_SCHEDULER_add_delayed (delay,
395 &publish_zone_dht_next, 399 &publish_zone_namestore_next,
396 NULL); 400 NULL);
397} 401}
398 402
@@ -516,7 +520,6 @@ dht_put_continuation (void *cls)
516{ 520{
517 struct DhtPutActivity *ma = cls; 521 struct DhtPutActivity *ma = cls;
518 522
519 num_public_records++;
520 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 523 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
521 "PUT complete\n"); 524 "PUT complete\n");
522 dht_queue_length--; 525 dht_queue_length--;
@@ -524,13 +527,9 @@ dht_put_continuation (void *cls)
524 it_tail, 527 it_tail,
525 ma); 528 ma);
526 GNUNET_free (ma); 529 GNUNET_free (ma);
527 put_cnt++;
528 if (0 == put_cnt % DELTA_INTERVAL)
529 update_velocity ();
530} 530}
531 531
532 532
533
534/** 533/**
535 * Convert namestore records from the internal format to that 534 * Convert namestore records from the internal format to that
536 * suitable for publication (removes private records, converts 535 * suitable for publication (removes private records, converts
@@ -634,6 +633,7 @@ perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
634 label, 633 label,
635 GNUNET_STRINGS_absolute_time_to_string (expire), 634 GNUNET_STRINGS_absolute_time_to_string (expire),
636 GNUNET_h2s (&query)); 635 GNUNET_h2s (&query));
636 num_public_records++;
637 ret = GNUNET_DHT_put (dht_handle, 637 ret = GNUNET_DHT_put (dht_handle,
638 &query, 638 &query,
639 DHT_GNS_REPLICATION_LEVEL, 639 DHT_GNS_REPLICATION_LEVEL,
@@ -769,7 +769,6 @@ put_gns_record (void *cls,
769 769
770 (void) cls; 770 (void) cls;
771 ns_iteration_left--; 771 ns_iteration_left--;
772 check_zone_dht_next ();
773 rd_public_count = convert_records_for_export (rd, 772 rd_public_count = convert_records_for_export (rd,
774 rd_count, 773 rd_count,
775 rd_public); 774 rd_public);
@@ -777,6 +776,7 @@ put_gns_record (void *cls,
777 { 776 {
778 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 777 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
779 "Record set empty, moving to next record set\n"); 778 "Record set empty, moving to next record set\n");
779 check_zone_namestore_next ();
780 return; 780 return;
781 } 781 }
782 /* We got a set of records to publish */ 782 /* We got a set of records to publish */
@@ -790,6 +790,10 @@ put_gns_record (void *cls,
790 rd_public_count, 790 rd_public_count,
791 &dht_put_continuation, 791 &dht_put_continuation,
792 ma); 792 ma);
793 put_cnt++;
794 if (0 == put_cnt % DELTA_INTERVAL)
795 update_velocity ();
796 check_zone_namestore_next ();
793 if (NULL == ma->ph) 797 if (NULL == ma->ph)
794 { 798 {
795 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 799 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,