diff options
Diffstat (limited to 'src/service/testing/testing_api_loop.c')
-rw-r--r-- | src/service/testing/testing_api_loop.c | 57 |
1 files 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 | |||
@@ -45,6 +45,11 @@ struct GNUNET_TESTING_Interpreter | |||
45 | const struct GNUNET_HELPER_Handle **helper; | 45 | const struct GNUNET_HELPER_Handle **helper; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Handle to a send op | ||
49 | */ | ||
50 | struct GNUNET_HELPER_SendHandle *send_handle; | ||
51 | |||
52 | /** | ||
48 | * Size of the array helper. | 53 | * Size of the array helper. |
49 | * | 54 | * |
50 | */ | 55 | */ |
@@ -357,6 +362,11 @@ finish_test (void *cls) | |||
357 | GNUNET_SCHEDULER_cancel (is->timeout_task); | 362 | GNUNET_SCHEDULER_cancel (is->timeout_task); |
358 | is->timeout_task = NULL; | 363 | is->timeout_task = NULL; |
359 | } | 364 | } |
365 | if (NULL != is->send_handle) | ||
366 | { | ||
367 | GNUNET_HELPER_send_cancel (is->send_handle); | ||
368 | is->send_handle = NULL; | ||
369 | } | ||
360 | GNUNET_free (is->commands); | 370 | GNUNET_free (is->commands); |
361 | is->rc (is->rc_cls, | 371 | is->rc (is->rc_cls, |
362 | is->result); | 372 | is->result); |
@@ -731,37 +741,6 @@ GNUNET_TESTING_add_netjail_helper (struct GNUNET_TESTING_Interpreter *is, | |||
731 | } | 741 | } |
732 | 742 | ||
733 | 743 | ||
734 | /** | ||
735 | * Send Message to netjail nodes. | ||
736 | * | ||
737 | * @param is The interpreter. | ||
738 | * @param global_node_number The netjail node to inform. | ||
739 | * @param header The message to send. | ||
740 | */ | ||
741 | static void | ||
742 | send_message_to_netjail (struct GNUNET_TESTING_Interpreter *is, | ||
743 | unsigned int global_node_number, | ||
744 | struct GNUNET_MessageHeader *header) | ||
745 | { | ||
746 | const struct GNUNET_HELPER_Handle *helper; | ||
747 | |||
748 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
749 | "send message of type %u to locals\n", | ||
750 | ntohs (header->type)); | ||
751 | helper = is->helper[global_node_number - 1]; | ||
752 | /** | ||
753 | FIXME: This should probably be put into a linked list | ||
754 | inside is and cleaned up at some point. | ||
755 | */ | ||
756 | struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send ( | ||
757 | (struct GNUNET_HELPER_Handle *) helper, | ||
758 | header, | ||
759 | GNUNET_NO, | ||
760 | &clear_msg, | ||
761 | NULL); | ||
762 | } | ||
763 | |||
764 | |||
765 | void | 744 | void |
766 | TST_interpreter_send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is, | 745 | TST_interpreter_send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is, |
767 | const char *barrier_name, | 746 | const char *barrier_name, |
@@ -780,9 +759,19 @@ TST_interpreter_send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is, | |||
780 | adm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE); | 759 | adm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE); |
781 | adm->header.size = htons ((uint16_t) msg_length); | 760 | adm->header.size = htons ((uint16_t) msg_length); |
782 | memcpy (&adm[1], barrier_name, name_len); | 761 | memcpy (&adm[1], barrier_name, name_len); |
783 | send_message_to_netjail (is, | 762 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
784 | global_node_number, | 763 | "send message of type %u to locals\n", |
785 | &adm->header); | 764 | ntohs (adm->header.type)); |
765 | /** | ||
766 | FIXME: This should probably be put into a linked list | ||
767 | inside is and cleaned up at some point. | ||
768 | */ | ||
769 | is->send_handle = GNUNET_HELPER_send ( | ||
770 | (struct GNUNET_HELPER_Handle *) is->helper[global_node_number - 1], | ||
771 | &adm->header, | ||
772 | GNUNET_NO, | ||
773 | &clear_msg, | ||
774 | NULL); | ||
786 | GNUNET_free (adm); | 775 | GNUNET_free (adm); |
787 | } | 776 | } |
788 | 777 | ||