gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: TESTING: Fix proper handling of send han


From: gnunet
Subject: [gnunet] branch master updated: TESTING: Fix proper handling of send handle in test loop.
Date: Thu, 09 Nov 2023 10:18:32 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 8514ee9be TESTING: Fix proper handling of send handle in test loop.
8514ee9be is described below

commit 8514ee9bee5bb9ee35757b9e84e49b841f09b88c
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Thu Nov 9 10:18:10 2023 +0100

    TESTING: Fix proper handling of send handle in test loop.
---
 src/service/testing/testing_api_loop.c | 57 ++++++++++++++--------------------
 1 file changed, 23 insertions(+), 34 deletions(-)

diff --git a/src/service/testing/testing_api_loop.c 
b/src/service/testing/testing_api_loop.c
index 11cd02ec0..559a61c38 100644
--- a/src/service/testing/testing_api_loop.c
+++ b/src/service/testing/testing_api_loop.c
@@ -44,6 +44,11 @@ struct GNUNET_TESTING_Interpreter
    */
   const struct GNUNET_HELPER_Handle **helper;
 
+  /**
+   * Handle to a send op
+   */
+  struct GNUNET_HELPER_SendHandle *send_handle;
+
   /**
    * Size of the array helper.
    *
@@ -357,6 +362,11 @@ finish_test (void *cls)
     GNUNET_SCHEDULER_cancel (is->timeout_task);
     is->timeout_task = NULL;
   }
+  if (NULL != is->send_handle)
+  {
+    GNUNET_HELPER_send_cancel (is->send_handle);
+    is->send_handle = NULL;
+  }
   GNUNET_free (is->commands);
   is->rc (is->rc_cls,
           is->result);
@@ -731,37 +741,6 @@ GNUNET_TESTING_add_netjail_helper (struct 
GNUNET_TESTING_Interpreter *is,
 }
 
 
-/**
- * Send Message to netjail nodes.
- *
- * @param is The interpreter.
- * @param global_node_number The netjail node to inform.
- * @param header The message to send.
- */
-static void
-send_message_to_netjail (struct GNUNET_TESTING_Interpreter *is,
-                         unsigned int global_node_number,
-                         struct GNUNET_MessageHeader *header)
-{
-  const struct GNUNET_HELPER_Handle *helper;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "send message of type %u to locals\n",
-              ntohs (header->type));
-  helper = is->helper[global_node_number - 1];
-  /**
-     FIXME: This should probably be put into a linked list
-     inside is and cleaned up at some point.
-  */
-  struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
-    (struct GNUNET_HELPER_Handle *) helper,
-    header,
-    GNUNET_NO,
-    &clear_msg,
-    NULL);
-}
-
-
 void
 TST_interpreter_send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is,
                                         const char *barrier_name,
@@ -780,9 +759,19 @@ TST_interpreter_send_barrier_crossable (struct 
GNUNET_TESTING_Interpreter *is,
   adm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE);
   adm->header.size = htons ((uint16_t) msg_length);
   memcpy (&adm[1], barrier_name, name_len);
-  send_message_to_netjail (is,
-                           global_node_number,
-                           &adm->header);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "send message of type %u to locals\n",
+              ntohs (adm->header.type));
+  /**
+     FIXME: This should probably be put into a linked list
+     inside is and cleaned up at some point.
+  */
+  is->send_handle = GNUNET_HELPER_send (
+    (struct GNUNET_HELPER_Handle *) is->helper[global_node_number - 1],
+    &adm->header,
+    GNUNET_NO,
+    &clear_msg,
+    NULL);
   GNUNET_free (adm);
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]