LRN: Keep passing HELLO messages to transport
authorChristian Grothoff <christian@grothoff.org>
Mon, 1 Aug 2011 20:41:37 +0000 (20:41 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 1 Aug 2011 20:41:37 +0000 (20:41 +0000)
in core preferences, reliability and quota compliance tests,
because first HELLO might be empty

src/core/test_core_api_preferences.c
src/core/test_core_api_reliability.c
src/core/test_core_quota_compliance.c

index b74e969c185ae779d4b5a60fc53b80ef5d09603e..cc55f1644358396dc1821ab3846dcdcb534bf041 100644 (file)
@@ -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");
index fe0162188909dc2ed973b295cc755ab94028f6c2..b279acb91abf96eebbb4dedcd5cdb3fe04637167 100644 (file)
@@ -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");
index 593ffa1202678571b002277f0e35d008b7e9a79e..03a7c62eb59fb2b834bf883af687d7aeddff4e80 100644 (file)
@@ -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,