aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/gnunet-service-testbed.c')
-rw-r--r--src/testbed/gnunet-service-testbed.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index e4fe87fcd..8a286742c 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -130,12 +130,6 @@ static struct MessageQueue *mq_tail;
130 130
131 131
132/** 132/**
133 * The shutdown task handle
134 */
135static struct GNUNET_SCHEDULER_Task * shutdown_task_id;
136
137
138/**
139 * Function called to notify a client about the connection begin ready to queue 133 * Function called to notify a client about the connection begin ready to queue
140 * more data. "buf" will be NULL and "size" zero if the connection was closed 134 * more data. "buf" will be NULL and "size" zero if the connection was closed
141 * for writing in the meantime. 135 * for writing in the meantime.
@@ -480,7 +474,8 @@ parse_shared_services (char *ss_str, struct GNUNET_CONFIGURATION_Handle *cfg)
480 * @param message the actual message 474 * @param message the actual message
481 */ 475 */
482static void 476static void
483handle_init (void *cls, struct GNUNET_SERVER_Client *client, 477handle_init (void *cls,
478 struct GNUNET_SERVER_Client *client,
484 const struct GNUNET_MessageHeader *message) 479 const struct GNUNET_MessageHeader *message)
485{ 480{
486 const struct GNUNET_TESTBED_InitMessage *msg; 481 const struct GNUNET_TESTBED_InitMessage *msg;
@@ -553,14 +548,15 @@ handle_init (void *cls, struct GNUNET_SERVER_Client *client,
553 548
554 549
555/** 550/**
556 * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages 551 * Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages
557 * 552 *
558 * @param cls NULL 553 * @param cls NULL
559 * @param client identification of the client 554 * @param client identification of the client
560 * @param message the actual message 555 * @param message the actual message
561 */ 556 */
562static void 557static void
563handle_add_host (void *cls, struct GNUNET_SERVER_Client *client, 558handle_add_host (void *cls,
559 struct GNUNET_SERVER_Client *client,
564 const struct GNUNET_MessageHeader *message) 560 const struct GNUNET_MessageHeader *message)
565{ 561{
566 struct GNUNET_TESTBED_Host *host; 562 struct GNUNET_TESTBED_Host *host;
@@ -669,14 +665,15 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
669 665
670 666
671/** 667/**
672 * Handler for GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG messages 668 * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG messages
673 * 669 *
674 * @param cls NULL 670 * @param cls NULL
675 * @param client identification of the client 671 * @param client identification of the client
676 * @param message the actual message 672 * @param message the actual message
677 */ 673 */
678static void 674static void
679handle_slave_get_config (void *cls, struct GNUNET_SERVER_Client *client, 675handle_slave_get_config (void *cls,
676 struct GNUNET_SERVER_Client *client,
680 const struct GNUNET_MessageHeader *message) 677 const struct GNUNET_MessageHeader *message)
681{ 678{
682 struct GNUNET_TESTBED_SlaveGetConfigurationMessage *msg; 679 struct GNUNET_TESTBED_SlaveGetConfigurationMessage *msg;
@@ -781,7 +778,6 @@ shutdown_task (void *cls)
781 struct MessageQueue *mq_entry; 778 struct MessageQueue *mq_entry;
782 uint32_t id; 779 uint32_t id;
783 780
784 shutdown_task_id = NULL;
785 LOG_DEBUG ("Shutting down testbed service\n"); 781 LOG_DEBUG ("Shutting down testbed service\n");
786 /* cleanup any remaining forwarded operations */ 782 /* cleanup any remaining forwarded operations */
787 GST_clear_fopcq (); 783 GST_clear_fopcq ();
@@ -939,10 +935,7 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server,
939 GST_config = GNUNET_CONFIGURATION_dup (cfg); 935 GST_config = GNUNET_CONFIGURATION_dup (cfg);
940 GNUNET_SERVER_add_handlers (server, message_handlers); 936 GNUNET_SERVER_add_handlers (server, message_handlers);
941 GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL); 937 GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL);
942 shutdown_task_id = 938 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
943 GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_UNIT_FOREVER_REL,
944 GNUNET_SCHEDULER_PRIORITY_IDLE,
945 &shutdown_task, NULL);
946 LOG_DEBUG ("Testbed startup complete\n"); 939 LOG_DEBUG ("Testbed startup complete\n");
947 GST_stats_init (GST_config); 940 GST_stats_init (GST_config);
948 GST_barriers_init (GST_config); 941 GST_barriers_init (GST_config);
@@ -955,9 +948,10 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server,
955int 948int
956main (int argc, char *const *argv) 949main (int argc, char *const *argv)
957{ 950{
958 //sleep (15); /* Debugging */
959 return (GNUNET_OK == 951 return (GNUNET_OK ==
960 GNUNET_SERVICE_run (argc, argv, "testbed", GNUNET_SERVICE_OPTION_NONE, 952 GNUNET_SERVICE_run (argc, argv,
953 "testbed",
954 GNUNET_SERVICE_OPTION_NONE,
961 &testbed_run, NULL)) ? 0 : 1; 955 &testbed_run, NULL)) ? 0 : 1;
962} 956}
963 957