aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/statistics_api.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-03-05 17:40:00 +0000
committerBart Polot <bart@net.in.tum.de>2012-03-05 17:40:00 +0000
commit8d55b650ddeecf9e76e4dd6e03951340cc6f39d7 (patch)
tree8a6f86c26fb58a65109dc5550a890cbbd3426669 /src/statistics/statistics_api.c
parent65ffaca5903a9cb31050b8bd378f1bf4647b2549 (diff)
downloadgnunet-8d55b650ddeecf9e76e4dd6e03951340cc6f39d7.tar.gz
gnunet-8d55b650ddeecf9e76e4dd6e03951340cc6f39d7.zip
- Fix for #2177: don't wait forever to reconnect to the service during shutdown. In fact, don't wait at all.
Diffstat (limited to 'src/statistics/statistics_api.c')
-rw-r--r--src/statistics/statistics_api.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c
index 100121f2f..c0b978f70 100644
--- a/src/statistics/statistics_api.c
+++ b/src/statistics/statistics_api.c
@@ -416,6 +416,18 @@ static void
416reconnect_later (struct GNUNET_STATISTICS_Handle *h) 416reconnect_later (struct GNUNET_STATISTICS_Handle *h)
417{ 417{
418 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->backoff_task); 418 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->backoff_task);
419 if (h->do_destroy)
420 {
421 /* So we are shutting down and the service is not reachable.
422 * Chances are that it's down for good and we are not going to connect to
423 * it anymore.
424 * Give up and don't sync the rest of the data.
425 */
426 GNUNET_break (0);
427 h->do_destroy = GNUNET_NO;
428 GNUNET_STATISTICS_destroy (h, GNUNET_NO);
429 return;
430 }
419 h->backoff_task = 431 h->backoff_task =
420 GNUNET_SCHEDULER_add_delayed (h->backoff, &reconnect_task, h); 432 GNUNET_SCHEDULER_add_delayed (h->backoff, &reconnect_task, h);
421 h->backoff = GNUNET_TIME_relative_multiply (h->backoff, 2); 433 h->backoff = GNUNET_TIME_relative_multiply (h->backoff, 2);
@@ -837,6 +849,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
837 849
838 if (h == NULL) 850 if (h == NULL)
839 return; 851 return;
852 GNUNET_assert (GNUNET_NO == h->do_destroy); // Don't call twice.
840 if (GNUNET_SCHEDULER_NO_TASK != h->backoff_task) 853 if (GNUNET_SCHEDULER_NO_TASK != h->backoff_task)
841 { 854 {
842 GNUNET_SCHEDULER_cancel (h->backoff_task); 855 GNUNET_SCHEDULER_cancel (h->backoff_task);