diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-02-23 17:46:57 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-02-23 17:46:57 +0000 |
commit | c1807879dd129323d7fb0239d8dd0313a2d0b39f (patch) | |
tree | 8fc7744ae9cdb5d6062c7ab7a4edbe0fea60bcf0 /src/nse | |
parent | e337b9c7efb351e8bb6adba064068ea48f11b8d8 (diff) | |
download | gnunet-c1807879dd129323d7fb0239d8dd0313a2d0b39f.tar.gz gnunet-c1807879dd129323d7fb0239d8dd0313a2d0b39f.zip |
- Cancel tasks when freeing memory
Diffstat (limited to 'src/nse')
-rw-r--r-- | src/nse/gnunet-nse-profiler.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index 8d091c1ad..a10d23791 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c | |||
@@ -217,6 +217,12 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
217 | if (pos->nse_handle != NULL) | 217 | if (pos->nse_handle != NULL) |
218 | GNUNET_NSE_disconnect (pos->nse_handle); | 218 | GNUNET_NSE_disconnect (pos->nse_handle); |
219 | GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, pos); | 219 | GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, pos); |
220 | if (GNUNET_SCHEDULER_NO_TASK != pos->stats_task) | ||
221 | { | ||
222 | GNUNET_SCHEDULER_cancel (pos->stats_task); | ||
223 | if (NULL != pos->stats) | ||
224 | GNUNET_STATISTICS_destroy(pos->stats, GNUNET_NO); | ||
225 | } | ||
220 | GNUNET_free (pos); | 226 | GNUNET_free (pos); |
221 | } | 227 | } |
222 | 228 | ||
@@ -313,12 +319,12 @@ static void | |||
313 | core_get_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 319 | core_get_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
314 | { | 320 | { |
315 | struct NSEPeer *peer = cls; | 321 | struct NSEPeer *peer = cls; |
316 | 322 | ||
317 | peer->stats_task = GNUNET_SCHEDULER_NO_TASK; | ||
318 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | 323 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) |
319 | { | 324 | { |
320 | GNUNET_STATISTICS_destroy(peer->stats, GNUNET_NO); | 325 | GNUNET_STATISTICS_destroy(peer->stats, GNUNET_NO); |
321 | peer->stats = NULL; | 326 | peer->stats = NULL; |
327 | return; | ||
322 | } | 328 | } |
323 | else | 329 | else |
324 | { | 330 | { |
@@ -332,6 +338,7 @@ core_get_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
332 | GNUNET_TIME_UNIT_FOREVER_REL, | 338 | GNUNET_TIME_UNIT_FOREVER_REL, |
333 | NULL, &core_stats_iterator, peer); | 339 | NULL, &core_stats_iterator, peer); |
334 | } | 340 | } |
341 | peer->stats_task = GNUNET_SCHEDULER_NO_TASK; | ||
335 | } | 342 | } |
336 | 343 | ||
337 | /** | 344 | /** |