aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-06 18:24:05 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-06 18:24:05 +0000
commite6b55e45670cb905a1fff70fbdbc48809a41315e (patch)
treed4e617a43badc81cca4e45d88770e136ee538a75
parent4dbc295056fa19607cace8d0ea47857b03e01b28 (diff)
downloadgnunet-e6b55e45670cb905a1fff70fbdbc48809a41315e.tar.gz
gnunet-e6b55e45670cb905a1fff70fbdbc48809a41315e.zip
-cleaner
-rw-r--r--src/statistics/gnunet-statistics.c20
-rw-r--r--src/statistics/statistics_api.c8
2 files changed, 20 insertions, 8 deletions
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c
index 8b163ef89..85d8b8c4d 100644
--- a/src/statistics/gnunet-statistics.c
+++ b/src/statistics/gnunet-statistics.c
@@ -62,6 +62,7 @@ static int watch;
62 */ 62 */
63static int quiet; 63static int quiet;
64 64
65
65/** 66/**
66 * Callback function to process statistic values. 67 * Callback function to process statistic values.
67 * 68 *
@@ -103,18 +104,28 @@ cleanup (void *cls, int success)
103 FPRINTF (stderr, "%s", _("Failed to obtain statistics.\n")); 104 FPRINTF (stderr, "%s", _("Failed to obtain statistics.\n"));
104 ret = 1; 105 ret = 1;
105 } 106 }
106 if (h != NULL) 107 if (NULL != h)
108 {
107 GNUNET_STATISTICS_destroy (h, GNUNET_NO); 109 GNUNET_STATISTICS_destroy (h, GNUNET_NO);
110 h = NULL;
111 }
108} 112}
113
114
109static void 115static void
110shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 116shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
111{ 117{
112 struct GNUNET_STATISTICS_Handle *h = cls; 118 struct GNUNET_STATISTICS_Handle *h = cls;
119
113 GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h); 120 GNUNET_STATISTICS_watch_cancel (h, subsystem, name, &printer, h);
114 if (h != NULL) 121 if (NULL != h)
122 {
115 GNUNET_STATISTICS_destroy (h, GNUNET_NO); 123 GNUNET_STATISTICS_destroy (h, GNUNET_NO);
124 h = NULL;
125 }
116} 126}
117 127
128
118/** 129/**
119 * Main function that will be run by the scheduler. 130 * Main function that will be run by the scheduler.
120 * 131 *
@@ -140,17 +151,18 @@ run (void *cls, char *const *args, const char *cfgfile,
140 return; 151 return;
141 } 152 }
142 h = GNUNET_STATISTICS_create (subsystem, cfg); 153 h = GNUNET_STATISTICS_create (subsystem, cfg);
143 if (h == NULL) 154 if (NULL == h)
144 { 155 {
145 ret = 1; 156 ret = 1;
146 return; 157 return;
147 } 158 }
148 GNUNET_STATISTICS_set (h, name, (uint64_t) val, persistent); 159 GNUNET_STATISTICS_set (h, name, (uint64_t) val, persistent);
149 GNUNET_STATISTICS_destroy (h, GNUNET_YES); 160 GNUNET_STATISTICS_destroy (h, GNUNET_YES);
161 h = NULL;
150 return; 162 return;
151 } 163 }
152 h = GNUNET_STATISTICS_create ("gnunet-statistics", cfg); 164 h = GNUNET_STATISTICS_create ("gnunet-statistics", cfg);
153 if (h == NULL) 165 if (NULL == h)
154 { 166 {
155 ret = 1; 167 ret = 1;
156 return; 168 return;
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c
index 6ce10421a..85eb569eb 100644
--- a/src/statistics/statistics_api.c
+++ b/src/statistics/statistics_api.c
@@ -412,7 +412,6 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
412} 412}
413 413
414 414
415
416/** 415/**
417 * Task used by 'reconnect_later' to shutdown the handle 416 * Task used by 'reconnect_later' to shutdown the handle
418 * 417 *
@@ -428,6 +427,7 @@ do_destroy (void *cls,
428 GNUNET_STATISTICS_destroy (h, GNUNET_NO); 427 GNUNET_STATISTICS_destroy (h, GNUNET_NO);
429} 428}
430 429
430
431/** 431/**
432 * Reconnect at a later time, respecting back-off. 432 * Reconnect at a later time, respecting back-off.
433 * 433 *
@@ -911,7 +911,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
911 } 911 }
912 if (sync_first) 912 if (sync_first)
913 { 913 {
914 if (h->current != NULL) 914 if (NULL != h->current)
915 { 915 {
916 if (h->current->type == ACTION_GET) 916 if (h->current->type == ACTION_GET)
917 { 917 {
@@ -947,9 +947,9 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first)
947 GNUNET_CLIENT_notify_transmit_ready (h->client, h->current->msize, 947 GNUNET_CLIENT_notify_transmit_ready (h->client, h->current->msize,
948 timeout, GNUNET_YES, 948 timeout, GNUNET_YES,
949 &transmit_action, h); 949 &transmit_action, h);
950 GNUNET_assert (NULL != h->th); 950 GNUNET_assert (NULL != h->th);
951 } 951 }
952 if (h->th != NULL) 952 if (NULL != h->th)
953 return; /* do not finish destruction just yet */ 953 return; /* do not finish destruction just yet */
954 } 954 }
955 while (NULL != (pos = h->action_head)) 955 while (NULL != (pos = h->action_head))