aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-29 16:10:45 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-29 16:10:45 +0000
commitf37a1330954a757525a34ebecc074412e66d7fe8 (patch)
treed364b531b51e27e776338a328bcb9409fd48a1c9 /src/gns/gnunet-service-gns.c
parentd980fb328a9ba1f6fe2e54d9b2d88b57d0d8016f (diff)
downloadgnunet-f37a1330954a757525a34ebecc074412e66d7fe8.tar.gz
gnunet-f37a1330954a757525a34ebecc074412e66d7fe8.zip
-add extra checks to catch shutdown bug
Diffstat (limited to 'src/gns/gnunet-service-gns.c')
-rw-r--r--src/gns/gnunet-service-gns.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index e2bb0ad8c..78c8e8233 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -274,9 +274,12 @@ shutdown_task (void *cls)
274 } 274 }
275 while (NULL != (clh = clh_head)) 275 while (NULL != (clh = clh_head))
276 { 276 {
277 GNUNET_SERVER_client_set_user_context (clh->client, NULL); 277 GNUNET_SERVER_client_set_user_context (clh->client,
278 NULL);
278 GNS_resolver_lookup_cancel (clh->lookup); 279 GNS_resolver_lookup_cancel (clh->lookup);
279 GNUNET_CONTAINER_DLL_remove (clh_head, clh_tail, clh); 280 GNUNET_CONTAINER_DLL_remove (clh_head,
281 clh_tail,
282 clh);
280 GNUNET_free (clh); 283 GNUNET_free (clh);
281 } 284 }
282 285
@@ -303,7 +306,8 @@ shutdown_task (void *cls)
303 } 306 }
304 if (NULL != statistics) 307 if (NULL != statistics)
305 { 308 {
306 GNUNET_STATISTICS_destroy (statistics, GNUNET_NO); 309 GNUNET_STATISTICS_destroy (statistics,
310 GNUNET_NO);
307 statistics = NULL; 311 statistics = NULL;
308 } 312 }
309 if (NULL != zone_publish_task) 313 if (NULL != zone_publish_task)
@@ -353,6 +357,7 @@ static void
353publish_zone_dht_next (void *cls) 357publish_zone_dht_next (void *cls)
354{ 358{
355 zone_publish_task = NULL; 359 zone_publish_task = NULL;
360 GNUNET_assert (NULL != namestore_iter);
356 GNUNET_NAMESTORE_zone_iterator_next (namestore_iter); 361 GNUNET_NAMESTORE_zone_iterator_next (namestore_iter);
357} 362}
358 363
@@ -401,6 +406,7 @@ dht_put_continuation (void *cls,
401 "Current zone iteration interval (ms)", 406 "Current zone iteration interval (ms)",
402 next_put_interval.rel_value_us / 1000LL, 407 next_put_interval.rel_value_us / 1000LL,
403 GNUNET_NO); 408 GNUNET_NO);
409 GNUNET_assert (NULL == zone_publish_task);
404 zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval, 410 zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval,
405 &publish_zone_dht_next, 411 &publish_zone_dht_next,
406 NULL); 412 NULL);
@@ -584,6 +590,7 @@ put_gns_record (void *cls,
584 "Number of public records in DHT", 590 "Number of public records in DHT",
585 last_num_public_records, 591 last_num_public_records,
586 GNUNET_NO); 592 GNUNET_NO);
593 GNUNET_assert (NULL == zone_publish_task);
587 if (0 == num_public_records) 594 if (0 == num_public_records)
588 zone_publish_task = GNUNET_SCHEDULER_add_delayed (put_interval, 595 zone_publish_task = GNUNET_SCHEDULER_add_delayed (put_interval,
589 &publish_zone_dht_start, 596 &publish_zone_dht_start,
@@ -601,6 +608,7 @@ put_gns_record (void *cls,
601 /* We got a set of records to publish */ 608 /* We got a set of records to publish */
602 if (0 == rd_public_count) 609 if (0 == rd_public_count)
603 { 610 {
611 GNUNET_assert (NULL == zone_publish_task);
604 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_next, 612 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_next,
605 NULL); 613 NULL);
606 return; 614 return;
@@ -633,6 +641,7 @@ publish_zone_dht_start (void *cls)
633 "Starting DHT zone update!\n"); 641 "Starting DHT zone update!\n");
634 /* start counting again */ 642 /* start counting again */
635 num_public_records = 0; 643 num_public_records = 0;
644 GNUNET_assert (NULL == namestore_iter);
636 namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle, 645 namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle,
637 NULL, /* All zones */ 646 NULL, /* All zones */
638 &put_gns_record, NULL ); 647 &put_gns_record, NULL );
@@ -846,6 +855,7 @@ notify_client_disconnect (void *cls,
846static void 855static void
847monitor_sync_event (void *cls) 856monitor_sync_event (void *cls)
848{ 857{
858 GNUNET_assert (NULL == zone_publish_task);
849 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, 859 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start,
850 NULL); 860 NULL);
851} 861}