gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18701 - gnunet/src/statistics


From: gnunet
Subject: [GNUnet-SVN] r18701 - gnunet/src/statistics
Date: Mon, 19 Dec 2011 21:48:41 +0100

Author: grothoff
Date: 2011-12-19 21:48:41 +0100 (Mon, 19 Dec 2011)
New Revision: 18701

Modified:
   gnunet/src/statistics/statistics_api.c
Log:
-do not crash on exit if we are not connected to statistics while trying to 
submit mandatory values; just force instant connect

Modified: gnunet/src/statistics/statistics_api.c
===================================================================
--- gnunet/src/statistics/statistics_api.c      2011-12-19 20:40:58 UTC (rev 
18700)
+++ gnunet/src/statistics/statistics_api.c      2011-12-19 20:48:41 UTC (rev 
18701)
@@ -904,12 +904,25 @@
     h->do_destroy = GNUNET_YES;
     if ((h->current != NULL) && (h->th == NULL))
     {
-      timeout = GNUNET_TIME_absolute_get_remaining (h->current->timeout);
-      h->th =
+      if (NULL == h->client)
+      {
+       /* instant-connect (regardless of back-off) to submit final value */
+       if (GNUNET_SCHEDULER_NO_TASK != h->backoff_task)
+       {
+         GNUNET_SCHEDULER_cancel (h->backoff_task);
+         h->backoff_task = GNUNET_SCHEDULER_NO_TASK;
+       }
+       h->client = GNUNET_CLIENT_connect ("statistics", h->cfg);
+      }
+      if (NULL != h->client)
+      {
+       timeout = GNUNET_TIME_absolute_get_remaining (h->current->timeout);
+       h->th =
           GNUNET_CLIENT_notify_transmit_ready (h->client, h->current->msize,
                                                timeout, GNUNET_YES,
                                                &transmit_action, h);
-      GNUNET_assert (NULL != h->th);
+       GNUNET_assert (NULL != h->th);
+      }
     }
     if (h->th != NULL)
       return;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]