diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-19 20:48:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-19 20:48:41 +0000 |
commit | 0e16e2c10f6790bd231a7090212f6f856577418c (patch) | |
tree | 64f44388c00853296b2177adaa6233b0b5af464b /src/statistics/statistics_api.c | |
parent | 5fabca7beac62bbbcdf62def324b4ee7405d501c (diff) | |
download | gnunet-0e16e2c10f6790bd231a7090212f6f856577418c.tar.gz gnunet-0e16e2c10f6790bd231a7090212f6f856577418c.zip |
-do not crash on exit if we are not connected to statistics while trying to submit mandatory values; just force instant connect
Diffstat (limited to 'src/statistics/statistics_api.c')
-rw-r--r-- | src/statistics/statistics_api.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index ca435a371..f4f91538a 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c | |||
@@ -904,12 +904,25 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first) | |||
904 | h->do_destroy = GNUNET_YES; | 904 | h->do_destroy = GNUNET_YES; |
905 | if ((h->current != NULL) && (h->th == NULL)) | 905 | if ((h->current != NULL) && (h->th == NULL)) |
906 | { | 906 | { |
907 | timeout = GNUNET_TIME_absolute_get_remaining (h->current->timeout); | 907 | if (NULL == h->client) |
908 | h->th = | 908 | { |
909 | /* instant-connect (regardless of back-off) to submit final value */ | ||
910 | if (GNUNET_SCHEDULER_NO_TASK != h->backoff_task) | ||
911 | { | ||
912 | GNUNET_SCHEDULER_cancel (h->backoff_task); | ||
913 | h->backoff_task = GNUNET_SCHEDULER_NO_TASK; | ||
914 | } | ||
915 | h->client = GNUNET_CLIENT_connect ("statistics", h->cfg); | ||
916 | } | ||
917 | if (NULL != h->client) | ||
918 | { | ||
919 | timeout = GNUNET_TIME_absolute_get_remaining (h->current->timeout); | ||
920 | h->th = | ||
909 | GNUNET_CLIENT_notify_transmit_ready (h->client, h->current->msize, | 921 | GNUNET_CLIENT_notify_transmit_ready (h->client, h->current->msize, |
910 | timeout, GNUNET_YES, | 922 | timeout, GNUNET_YES, |
911 | &transmit_action, h); | 923 | &transmit_action, h); |
912 | GNUNET_assert (NULL != h->th); | 924 | GNUNET_assert (NULL != h->th); |
925 | } | ||
913 | } | 926 | } |
914 | if (h->th != NULL) | 927 | if (h->th != NULL) |
915 | return; | 928 | return; |