aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-07-27 12:02:07 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-07-27 12:02:07 +0000
commitb9617164f8546d438717f49303c150bf13eb2d20 (patch)
tree7ceb5cf0d3ef39e01e521cd92a3326e86671cee4 /src/testbed
parent1eecfe59914c7c549e666198080b0523a4609004 (diff)
downloadgnunet-b9617164f8546d438717f49303c150bf13eb2d20.tar.gz
gnunet-b9617164f8546d438717f49303c150bf13eb2d20.zip
removed slave context
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed.c48
1 files changed, 16 insertions, 32 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index 0b19d6e5c..6f7e38429 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -169,23 +169,6 @@ struct Slave
169 169
170 170
171/** 171/**
172 * Slave startup context
173 */
174struct SlaveContext
175{
176 /**
177 * The slave corresponding to this context
178 */
179 struct Slave *slave;
180
181 /**
182 * The configuration used as a template while startup
183 */
184 struct GNUNET_CONFIGURATION_Handle *cfg;
185};
186
187
188/**
189 * States of LCFContext 172 * States of LCFContext
190 */ 173 */
191enum LCFContextState 174enum LCFContextState
@@ -768,22 +751,20 @@ slave_status_callback (void *cls,
768 const struct GNUNET_CONFIGURATION_Handle *cfg, 751 const struct GNUNET_CONFIGURATION_Handle *cfg,
769 int status) 752 int status)
770{ 753{
771 struct SlaveContext *sc = cls; 754 struct Slave *slave = cls;
772 755
773 if (GNUNET_SYSERR == status) 756 if (GNUNET_SYSERR == status)
774 { 757 {
775 sc->slave->controller_proc = NULL; 758 slave->controller_proc = NULL;
776 LOG (GNUNET_ERROR_TYPE_WARNING, 759 LOG (GNUNET_ERROR_TYPE_WARNING,
777 "Unexpected slave shutdown\n"); 760 "Unexpected slave shutdown\n");
778 GNUNET_SCHEDULER_shutdown (); /* We too shutdown */ 761 GNUNET_SCHEDULER_shutdown (); /* We too shutdown */
779 return; 762 return;
780 } 763 }
781 GNUNET_CONFIGURATION_destroy (sc->cfg); 764 slave->controller =
782 sc->slave->controller = 765 GNUNET_TESTBED_controller_connect (cfg, host_list[slave->host_id],
783 GNUNET_TESTBED_controller_connect (cfg, host_list[sc->slave->host_id],
784 master_context->event_mask, 766 master_context->event_mask,
785 &slave_event_callback, sc->slave); 767 &slave_event_callback, slave);
786 GNUNET_free (sc);
787} 768}
788 769
789 770
@@ -1023,7 +1004,6 @@ handle_link_controllers (void *cls,
1023{ 1004{
1024 const struct GNUNET_TESTBED_ControllerLinkMessage *msg; 1005 const struct GNUNET_TESTBED_ControllerLinkMessage *msg;
1025 struct GNUNET_CONFIGURATION_Handle *cfg; 1006 struct GNUNET_CONFIGURATION_Handle *cfg;
1026 struct SlaveContext *sc;
1027 struct LCFContextQueue *lcfq; 1007 struct LCFContextQueue *lcfq;
1028 struct Route *route; 1008 struct Route *route;
1029 struct Route *new_route; 1009 struct Route *new_route;
@@ -1125,19 +1105,23 @@ handle_link_controllers (void *cls,
1125 return; 1105 return;
1126 } 1106 }
1127 slave = GNUNET_malloc (sizeof (struct Slave)); 1107 slave = GNUNET_malloc (sizeof (struct Slave));
1128 slave->host_id = delegated_host_id; 1108 slave->host_id = delegated_host_id;
1129 slave_list_add (slave); 1109 slave_list_add (slave);
1130 sc = GNUNET_malloc (sizeof (struct SlaveContext));
1131 sc->slave = slave;
1132 sc->cfg = cfg;
1133 if (1 == msg->is_subordinate) 1110 if (1 == msg->is_subordinate)
1134 { 1111 {
1135 slave->controller_proc = 1112 slave->controller_proc =
1136 GNUNET_TESTBED_controller_start (master_context->master_ip, 1113 GNUNET_TESTBED_controller_start (master_context->master_ip,
1137 host_list[slave->host_id], 1114 host_list[slave->host_id],
1138 cfg, &slave_status_callback, 1115 cfg, &slave_status_callback,
1139 sc); 1116 slave);
1140 } 1117 }
1118 else {
1119 slave->controller =
1120 GNUNET_TESTBED_controller_connect (cfg, host_list[slave->host_id],
1121 master_context->event_mask,
1122 &slave_event_callback, slave);
1123 }
1124 GNUNET_CONFIGURATION_destroy (cfg);
1141 new_route = GNUNET_malloc (sizeof (struct Route)); 1125 new_route = GNUNET_malloc (sizeof (struct Route));
1142 new_route->dest = delegated_host_id; 1126 new_route->dest = delegated_host_id;
1143 new_route->thru = master_context->host_id; 1127 new_route->thru = master_context->host_id;