- struct Slave *slave;
- struct LinkControllersContext *lcc;
-
- if (1 != msg->is_subordinate)
- {
- struct Neighbour *n;
- struct NeighbourConnectCtxt *ncc;
-
- if ((delegated_host_id < neighbour_list_size) &&
- (NULL != neighbour_list[delegated_host_id]))
- {
- GNUNET_break(0);
- GNUNET_SERVICE_client_drop(client);
- return;
- }
- LOG_DEBUG("Received request to establish a link to host %u\n",
- delegated_host_id);
- n = GST_create_neighbour(GST_host_list[delegated_host_id]);
- ncc = GNUNET_new(struct NeighbourConnectCtxt);
- ncc->n = n;
- ncc->op_id = op_id;
- ncc->client = client;
- ncc->nh = GST_neighbour_get_connection(n,
- &neighbour_connect_cb,
- ncc);
- ncc->timeout_task
- = GNUNET_SCHEDULER_add_delayed(GST_timeout,
- &timeout_neighbour_connect,
- ncc);
- GNUNET_CONTAINER_DLL_insert_tail(ncc_head,
- ncc_tail,
- ncc);
- GNUNET_SERVICE_client_continue(client);
- return;
- }
- if ((delegated_host_id < GST_slave_list_size) &&
- (NULL != GST_slave_list[delegated_host_id]))
- {
- GNUNET_break(0);
- GNUNET_SERVICE_client_drop(client);
- return;
- }
- LOG_DEBUG("Received request to start and establish a link to host %u\n",
- delegated_host_id);
- slave = GNUNET_new(struct Slave);
- slave->host_id = delegated_host_id;
- slave->reghost_map = GNUNET_CONTAINER_multihashmap_create(100,
- GNUNET_NO);
- slave_list_add(slave);
- lcc = GNUNET_new(struct LinkControllersContext);
- lcc->operation_id = op_id;
- lcc->client = client;
- slave->lcc = lcc;
- slave->controller_proc
- = GNUNET_TESTBED_controller_start(GST_context->master_ip,
- GST_host_list[slave->host_id],
- &slave_status_cb,
- slave);
- new_route = GNUNET_new(struct Route);
- new_route->dest = delegated_host_id;
- new_route->thru = GST_context->host_id;
- route_list_add(new_route);