gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r21342 - in gnunet/src: include statistics testing


From: gnunet
Subject: [GNUnet-SVN] r21342 - in gnunet/src: include statistics testing
Date: Tue, 8 May 2012 15:33:52 +0200

Author: bartpolot
Date: 2012-05-08 15:33:51 +0200 (Tue, 08 May 2012)
New Revision: 21342

Modified:
   gnunet/src/include/gnunet_statistics_service.h
   gnunet/src/statistics/statistics_api.c
   gnunet/src/testing/testing_group.c
Log:
- Document statistics api and fix testing's usage of it


Modified: gnunet/src/include/gnunet_statistics_service.h
===================================================================
--- gnunet/src/include/gnunet_statistics_service.h      2012-05-08 12:35:29 UTC 
(rev 21341)
+++ gnunet/src/include/gnunet_statistics_service.h      2012-05-08 13:33:51 UTC 
(rev 21342)
@@ -145,6 +145,7 @@
  * @param timeout after how long should we give up (and call
  *        notify with buf NULL and size 0)?
  * @param cont continuation to call when done (can be NULL)
+ *        This callback CANNOT destroy the statistics handle in the same call.
  * @param proc function to call on each value
  * @param cls closure for proc and cont
  * @return NULL on error

Modified: gnunet/src/statistics/statistics_api.c
===================================================================
--- gnunet/src/statistics/statistics_api.c      2012-05-08 12:35:29 UTC (rev 
21341)
+++ gnunet/src/statistics/statistics_api.c      2012-05-08 13:33:51 UTC (rev 
21342)
@@ -1075,6 +1075,7 @@
  * @param timeout after how long should we give up (and call
  *        cont with an error code)?
  * @param cont continuation to call when done (can be NULL)
+ *        This callback CANNOT destroy the statistics handle in the same call.
  * @param proc function to call on each value
  * @param cls closure for cont and proc
  * @return NULL on error

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2012-05-08 12:35:29 UTC (rev 21341)
+++ gnunet/src/testing/testing_group.c  2012-05-08 13:33:51 UTC (rev 21342)
@@ -4884,7 +4884,23 @@
                               subsystem, name, value, is_persistent);
 }
 
+
 /**
+ * We don't need the statistics handle anymore, destroy it.
+ * 
+ * @param cls Closure (the statistics handle to destroy)
+ * @param tc Task Context
+ */
+static void
+internal_destroy_statistics (void *cls, GNUNET_SCHEDULER_TaskContext *tc)
+{
+  struct GNUNET_STATISTICS_Handle *h = cls;
+
+  GNUNET_STATISTICS_destroy (h, GNUNET_NO);
+}
+
+
+/**
  * Internal continuation call for statistics iteration.
  *
  * @param cls closure, the CoreContext for this iteration
@@ -4908,7 +4924,9 @@
   }
 
   if (core_context->stats_handle != NULL)
-    GNUNET_STATISTICS_destroy (core_context->stats_handle, GNUNET_NO);
+    /* Cannot destroy handle inside the continuation */
+    GNUNET_SCHEDULER_add_now (&internal_destroy_statistics,
+                              core_context->stats_handle);
 
   GNUNET_free (core_context);
 }
@@ -5290,9 +5308,9 @@
   struct OutstandingSSH *pos;
 
   pos = pg->ssh_head;
-  while ((pos != NULL) && (strcmp (pos->hostname, hostname) != 0))
+  while ((NULL != pos) && (strcmp (pos->hostname, hostname) != 0))
     pos = pos->next;
-  GNUNET_assert (pos != NULL);
+  GNUNET_assert (NULL != pos);
   pos->outstanding++;
 }
 




reply via email to

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