[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24696 - gnunet/src/statistics
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24696 - gnunet/src/statistics |
Date: |
Sun, 4 Nov 2012 23:42:14 +0100 |
Author: grothoff
Date: 2012-11-04 23:42:14 +0100 (Sun, 04 Nov 2012)
New Revision: 24696
Modified:
gnunet/src/statistics/gnunet-statistics.c
Log:
-fix #2609
Modified: gnunet/src/statistics/gnunet-statistics.c
===================================================================
--- gnunet/src/statistics/gnunet-statistics.c 2012-11-04 21:49:29 UTC (rev
24695)
+++ gnunet/src/statistics/gnunet-statistics.c 2012-11-04 22:42:14 UTC (rev
24696)
@@ -73,6 +73,7 @@
*/
static unsigned long long remote_port;
+
/**
* Callback function to process statistic values.
*
@@ -138,17 +139,22 @@
}
+/**
+ * Function run on shutdown to clean up.
+ *
+ * @param cls the statistics handle
+ * @param tc scheduler context
+ */
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_STATISTICS_Handle *h = cls;
- if (NULL != h)
- {
- GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h);
- GNUNET_STATISTICS_destroy (h, GNUNET_NO);
- h = NULL;
- }
+ if (NULL == h)
+ return;
+ GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h);
+ GNUNET_STATISTICS_destroy (h, GNUNET_NO);
+ h = NULL;
}
@@ -210,9 +216,7 @@
h = NULL;
return;
}
- h = GNUNET_STATISTICS_create ("gnunet-statistics", cfg);
- GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
h);
- if (NULL == h)
+ if (NULL == (h = GNUNET_STATISTICS_create ("gnunet-statistics", cfg)))
{
ret = 1;
return;
@@ -229,8 +233,8 @@
if ((NULL == subsystem) || (NULL == name))
{
printf (_("No subsystem or name given\n"));
- if (h != NULL)
- GNUNET_STATISTICS_destroy (h, GNUNET_NO);
+ GNUNET_STATISTICS_destroy (h, GNUNET_NO);
+ h = NULL;
ret = 1;
return;
}
@@ -241,8 +245,11 @@
return;
}
}
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+ &shutdown_task, h);
}
+
/**
* The main function to obtain statistics in GNUnet.
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24696 - gnunet/src/statistics,
gnunet <=