aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-02 20:06:23 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-02 20:06:23 +0000
commitfc1374f2d850b1c7610ad239f9fe71beee5c5bd6 (patch)
tree0baac685973fb14f96a20e24a3286f86289ad981 /src/gns/gnunet-service-gns.c
parentf5578375b94757504d58994e4af829250d1330e6 (diff)
downloadgnunet-fc1374f2d850b1c7610ad239f9fe71beee5c5bd6.tar.gz
gnunet-fc1374f2d850b1c7610ad239f9fe71beee5c5bd6.zip
-handle namestore disconnect properly
Diffstat (limited to 'src/gns/gnunet-service-gns.c')
-rw-r--r--src/gns/gnunet-service-gns.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 78c8e8233..cb516d2c8 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -230,7 +230,7 @@ static struct GNUNET_TIME_Relative zone_publish_time_window;
230/** 230/**
231 * zone publish task 231 * zone publish task
232 */ 232 */
233static struct GNUNET_SCHEDULER_Task * zone_publish_task; 233static struct GNUNET_SCHEDULER_Task *zone_publish_task;
234 234
235/** 235/**
236 * #GNUNET_YES if zone has never been published before 236 * #GNUNET_YES if zone has never been published before
@@ -542,6 +542,19 @@ put_gns_record (void *cls,
542 struct GNUNET_GNSRECORD_Data rd_public[rd_count]; 542 struct GNUNET_GNSRECORD_Data rd_public[rd_count];
543 unsigned int rd_public_count; 543 unsigned int rd_public_count;
544 544
545 if ( (NULL == key) &&
546 (NULL == label) &&
547 (0 == rd_count) )
548 {
549 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
550 "Got disconnected from namestore database, retrying.\n");
551 if (NULL != zone_publish_task)
552 {
553 GNUNET_SCHEDULER_cancel (zone_publish_task);
554 zone_publish_task = NULL;
555 }
556 return;
557 }
545 if (NULL == label) 558 if (NULL == label)
546 { 559 {
547 /* we're done with one iteration, calculate when to do the next one */ 560 /* we're done with one iteration, calculate when to do the next one */
@@ -568,7 +581,7 @@ put_gns_record (void *cls,
568 GNUNET_TIME_relative_divide (min_relative_record_time, 4), 581 GNUNET_TIME_relative_divide (min_relative_record_time, 4),
569 zone_publish_time_window_default); 582 zone_publish_time_window_default);
570 put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, 583 put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window,
571 num_public_records); 584 num_public_records);
572 } 585 }
573 /* reset for next iteration */ 586 /* reset for next iteration */
574 min_relative_record_time = GNUNET_TIME_UNIT_FOREVER_REL; 587 min_relative_record_time = GNUNET_TIME_UNIT_FOREVER_REL;
@@ -577,7 +590,8 @@ put_gns_record (void *cls,
577 590
578 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
579 "Zone iteration finished. Adjusted zone iteration interval to %s\n", 592 "Zone iteration finished. Adjusted zone iteration interval to %s\n",
580 GNUNET_STRINGS_relative_time_to_string (put_interval, GNUNET_YES)); 593 GNUNET_STRINGS_relative_time_to_string (put_interval,
594 GNUNET_YES));
581 GNUNET_STATISTICS_set (statistics, 595 GNUNET_STATISTICS_set (statistics,
582 "Current zone iteration interval (in ms)", 596 "Current zone iteration interval (in ms)",
583 put_interval.rel_value_us / 1000LL, 597 put_interval.rel_value_us / 1000LL,
@@ -642,9 +656,11 @@ publish_zone_dht_start (void *cls)
642 /* start counting again */ 656 /* start counting again */
643 num_public_records = 0; 657 num_public_records = 0;
644 GNUNET_assert (NULL == namestore_iter); 658 GNUNET_assert (NULL == namestore_iter);
645 namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle, 659 namestore_iter
646 NULL, /* All zones */ 660 = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle,
647 &put_gns_record, NULL ); 661 NULL, /* All zones */
662 &put_gns_record,
663 NULL);
648} 664}
649 665
650 666