aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r--src/transport/transport-testing2.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 547f8611b..ba58776fb 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -137,6 +137,11 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle
137 GNUNET_TRANSPORT_TESTING_IncomingMessageCallback incoming_msg_cb; 137 GNUNET_TRANSPORT_TESTING_IncomingMessageCallback incoming_msg_cb;
138 138
139 /** 139 /**
140 * Our service handle
141 */
142 struct GNUNET_SERVICE_Handle *sh;
143
144 /**
140 * @brief Closure to the callback 145 * @brief Closure to the callback
141 */ 146 */
142 void *cb_cls; 147 void *cb_cls;
@@ -637,21 +642,15 @@ transport_communicator_start (
637 tc_h), 642 tc_h),
638 GNUNET_MQ_handler_end () 643 GNUNET_MQ_handler_end ()
639 }; 644 };
640 struct GNUNET_SERVICE_Handle *h;
641 645
642 h = GNUNET_SERVICE_start ("transport", 646
647 tc_h->sh = GNUNET_SERVICE_start ("transport",
643 tc_h->cfg, 648 tc_h->cfg,
644 &connect_cb, 649 &connect_cb,
645 &disconnect_cb, 650 &disconnect_cb,
646 tc_h, 651 tc_h,
647 mh); 652 mh);
648 if (NULL == h) 653 GNUNET_assert (NULL != tc_h->sh);
649 LOG (GNUNET_ERROR_TYPE_ERROR, "Failed starting service!\n");
650 else
651 {
652 LOG (GNUNET_ERROR_TYPE_DEBUG, "Started service\n");
653 /* TODO */ GNUNET_SCHEDULER_add_shutdown (&shutdown_service, h);
654 }
655} 654}
656 655
657 656
@@ -665,11 +664,11 @@ shutdown_communicator (void *cls)
665{ 664{
666 struct GNUNET_OS_Process *proc = cls; 665 struct GNUNET_OS_Process *proc = cls;
667 666
668 if (GNUNET_OK != GNUNET_OS_process_kill (proc, SIGTERM)) 667 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
669 { 668 {
670 LOG (GNUNET_ERROR_TYPE_WARNING, 669 LOG (GNUNET_ERROR_TYPE_WARNING,
671 "Error shutting down communicator with SIGERM, trying SIGKILL\n"); 670 "Error shutting down communicator with SIGERM, trying SIGKILL\n");
672 if (GNUNET_OK != GNUNET_OS_process_kill (proc, SIGKILL)) 671 if (0 != GNUNET_OS_process_kill (proc, SIGKILL))
673 { 672 {
674 LOG (GNUNET_ERROR_TYPE_ERROR, 673 LOG (GNUNET_ERROR_TYPE_ERROR,
675 "Error shutting down communicator with SIGERM and SIGKILL\n"); 674 "Error shutting down communicator with SIGERM and SIGKILL\n");
@@ -710,8 +709,15 @@ communicator_start (
710 } 709 }
711 LOG (GNUNET_ERROR_TYPE_INFO, "started communicator\n"); 710 LOG (GNUNET_ERROR_TYPE_INFO, "started communicator\n");
712 GNUNET_free (binary); 711 GNUNET_free (binary);
713 /* TODO */ GNUNET_SCHEDULER_add_shutdown (&shutdown_communicator, 712}
714 tc_h->c_proc); 713
714
715static void
716do_shutdown (void *cls)
717{
718 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
719 shutdown_communicator(tc_h->c_proc);
720 shutdown_service(tc_h->sh);
715} 721}
716 722
717 723
@@ -769,10 +775,10 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
769 /* Schedule start communicator */ 775 /* Schedule start communicator */
770 communicator_start (tc_h, 776 communicator_start (tc_h,
771 binary_name); 777 binary_name);
778 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, tc_h);
772 return tc_h; 779 return tc_h;
773} 780}
774 781
775
776/** 782/**
777 * @brief Instruct communicator to open a queue 783 * @brief Instruct communicator to open a queue
778 * 784 *