From: Christian Grothoff Date: Mon, 1 Aug 2011 20:41:37 +0000 (+0000) Subject: LRN: Keep passing HELLO messages to transport X-Git-Tag: initial-import-from-subversion-38251~17551 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e1a53be7657cf0ab0b6a25adbf6bf6649016e368;p=oweals%2Fgnunet.git LRN: Keep passing HELLO messages to transport in core preferences, reliability and quota compliance tests, because first HELLO might be empty --- diff --git a/src/core/test_core_api_preferences.c b/src/core/test_core_api_preferences.c index b74e969c1..cc55f1644 100644 --- a/src/core/test_core_api_preferences.c +++ b/src/core/test_core_api_preferences.c @@ -75,6 +75,7 @@ static GNUNET_SCHEDULER_TaskIdentifier ask_task; static unsigned int total_reserve = 5; +static void process_hello (void *cls, const struct GNUNET_MessageHeader *message); static void terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -84,6 +85,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) #endif GNUNET_assert (ok == 6); GNUNET_assert (NULL == irc); + GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); + GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); GNUNET_CORE_disconnect (p1.ch); GNUNET_CORE_disconnect (p2.ch); GNUNET_TRANSPORT_disconnect (p1.th); @@ -115,6 +118,8 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_SCHEDULER_cancel (ask_task); ask_task = GNUNET_SCHEDULER_NO_TASK; } + GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); + GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); GNUNET_CORE_disconnect (p1.ch); GNUNET_CORE_disconnect (p2.ch); GNUNET_TRANSPORT_disconnect (p1.th); @@ -418,7 +423,6 @@ process_hello (void *cls, { struct PeerContext *p = cls; - GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received (my) `%s' from transport service\n", "HELLO"); diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index fe0162188..b279acb91 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c @@ -112,12 +112,15 @@ get_size (unsigned int iter) return sizeof (struct TestMessage) + (ret % 60000); } +static void process_hello (void *cls, const struct GNUNET_MessageHeader *message); static void terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { unsigned long long delta; + GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); + GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); GNUNET_CORE_disconnect (p1.ch); p1.ch = NULL; GNUNET_CORE_disconnect (p2.ch); @@ -151,11 +154,13 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } if (p1.th != NULL) { + GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); GNUNET_TRANSPORT_disconnect (p1.th); p1.th = NULL; } if (p2.th != NULL) { + GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); GNUNET_TRANSPORT_disconnect (p2.th); p2.th = NULL; } @@ -437,7 +442,6 @@ process_hello (void *cls, { struct PeerContext *p = cls; - GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received (my) `%s' from transport service\n", "HELLO"); diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 593ffa120..03a7c62eb 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c @@ -114,11 +114,15 @@ struct TestMessage uint32_t num; }; +static void process_hello (void *cls, const struct GNUNET_MessageHeader *message); + static void terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_CORE_Handle *ch; + GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); + GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); ch = p1.ch; p1.ch = NULL; GNUNET_CORE_disconnect (ch); @@ -142,6 +146,9 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (measure_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel(measure_task); + GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); + GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); + GNUNET_CORE_disconnect (p1.ch); p1.ch = NULL; GNUNET_CORE_disconnect (p2.ch); @@ -572,7 +579,6 @@ process_hello (void *cls, { struct PeerContext *p = cls; - GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p); #if DEBUG_TRANSMISSION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,