From 4bd7ac5418b648e1b46a8b718a817059ac5b280b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 15 Dec 2010 02:34:41 +0000 Subject: [PATCH] fix segv on shutdown --- src/core/test_core_quota_compliance.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index f5b5c0d92..7181564d8 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c @@ -20,9 +20,6 @@ /** * @file core/test_core_quota_compliance.c * @brief testcase for core_api.c focusing quota compliance on core level - * - * FIXME: - * - make sure connect callback is invoked properly as well! */ #include "platform.h" #include "gnunet_common.h" @@ -122,10 +119,14 @@ struct TestMessage static void terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_CORE_disconnect (p1.ch); + struct GNUNET_CORE_Handle *ch; + + ch = p1.ch; p1.ch = NULL; - GNUNET_CORE_disconnect (p2.ch); + GNUNET_CORE_disconnect (ch); + ch = p2.ch; p2.ch = NULL; + GNUNET_CORE_disconnect (ch); GNUNET_TRANSPORT_disconnect (p1.th); p1.th = NULL; GNUNET_TRANSPORT_disconnect (p2.th); @@ -314,7 +315,8 @@ transmit_ready (void *cls, size_t size, void *buf) GNUNET_assert (size <= GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE); if (buf == NULL) { - if (p1.ch != NULL) + if ( (p1.ch != NULL) && + (p1.connect_status == 1) ) GNUNET_break (NULL != GNUNET_CORE_notify_transmit_ready (p1.ch, 0, -- 2.25.1