aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-10-31 15:36:56 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-10-31 15:36:56 +0000
commite5094e9070f768385078c0961262c77c5465d7ab (patch)
tree326f66fd54afb32f3f247a332d855c294b2fa443 /src
parent98f6a5d40e4d3b3f5af38e07fc94214b6c38e817 (diff)
downloadgnunet-e5094e9070f768385078c0961262c77c5465d7ab.tar.gz
gnunet-e5094e9070f768385078c0961262c77c5465d7ab.zip
dead code
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_protocols.h8
-rw-r--r--src/testbed/gnunet-service-testbed.c31
-rw-r--r--src/testbed/testbed.h23
-rw-r--r--src/testbed/testbed_api.c105
4 files changed, 10 insertions, 157 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 3c05182db..df123ceb1 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1552,16 +1552,10 @@ extern "C"
1552#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG 482 1552#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG 482
1553 1553
1554/** 1554/**
1555 * Message which is sent from a controller to the testbed API seeking the configuration
1556 * of the host whose id is contained in the message.
1557 */
1558#define GNUNET_MESSAGE_TYPE_TESTBED_NEEDCONTROLLERCONFIG 483
1559
1560/**
1561 * Not really a message, but for careful checks on the testbed messages; Should 1555 * Not really a message, but for careful checks on the testbed messages; Should
1562 * always be the maximum and never be used to send messages with this type 1556 * always be the maximum and never be used to send messages with this type
1563 */ 1557 */
1564#define GNUNET_MESSAGE_TYPE_TESTBED_MAX 484 1558#define GNUNET_MESSAGE_TYPE_TESTBED_MAX 483
1565 1559
1566/** 1560/**
1567 * The initialization message towards gnunet-testbed-helper 1561 * The initialization message towards gnunet-testbed-helper
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index 1ece6c6bb..24626d702 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -3311,31 +3311,18 @@ handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
3311 if ((peer2_host_id >= slave_list_size) 3311 if ((peer2_host_id >= slave_list_size)
3312 || (NULL ==slave_list[peer2_host_id])) 3312 || (NULL ==slave_list[peer2_host_id]))
3313 { 3313 {
3314 struct GNUNET_TESTBED_NeedControllerConfig *reply; 3314 LOG (GNUNET_ERROR_TYPE_WARNING,
3315 3315 "Configuration of peer2's controller missing for connecting peers"
3316 LOG_DEBUG ("Need controller configuration for connecting peers %u and %u\n", 3316 "%u and %u\n", p1, p2);
3317 p1, p2); 3317 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
3318 reply = GNUNET_malloc (sizeof (struct
3319 GNUNET_TESTBED_NeedControllerConfig));
3320 reply->header.size = htons (sizeof (struct
3321 GNUNET_TESTBED_NeedControllerConfig));
3322 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_NEEDCONTROLLERCONFIG);
3323 reply->controller_host_id = msg->peer2_host_id;
3324 reply->operation_id = msg->operation_id;
3325 queue_message (client, &reply->header);
3326 GNUNET_SERVER_receive_done (client, GNUNET_OK);
3327 return; 3318 return;
3328 } 3319 }
3329 else 3320 peer2_controller = slave_list[peer2_host_id]->controller;
3321 if (NULL == peer2_controller)
3330 { 3322 {
3331 //occ->peer2_controller = slave_list[peer2_host_id]->controller; 3323 GNUNET_break (0); /* What's going on? */
3332 peer2_controller = slave_list[peer2_host_id]->controller; 3324 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
3333 if (NULL == peer2_controller) 3325 return;
3334 {
3335 GNUNET_break (0); /* What's going on? */
3336 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
3337 return;
3338 }
3339 } 3326 }
3340 } 3327 }
3341 else 3328 else
diff --git a/src/testbed/testbed.h b/src/testbed/testbed.h
index 9274846ca..1e0cd2b4e 100644
--- a/src/testbed/testbed.h
+++ b/src/testbed/testbed.h
@@ -701,29 +701,6 @@ struct GNUNET_TESTBED_SlaveConfiguration
701}; 701};
702 702
703 703
704/**
705 * Message sent from a controller to the testbed API seeking the configuration
706 * of the host whose id is contained in the message.
707 */
708struct GNUNET_TESTBED_NeedControllerConfig
709{
710 /**
711 * Type is GNUNET_MESSAGE_TYPE_TESTBED_NEEDCONTROLLERCONFIG
712 */
713 struct GNUNET_MessageHeader header;
714
715 /**
716 * The id of the controller host
717 */
718 uint32_t controller_host_id GNUNET_PACKED;
719
720 /**
721 * Operation ID
722 */
723 uint64_t operation_id GNUNET_PACKED;
724
725};
726
727GNUNET_NETWORK_STRUCT_END 704GNUNET_NETWORK_STRUCT_END
728 705
729#endif 706#endif
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 5bba87c19..f48dc5103 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -864,103 +864,6 @@ handle_slave_config (struct GNUNET_TESTBED_Controller *c,
864 864
865 865
866/** 866/**
867 * Callback to check status for suboperations generated during overlay connect.
868 *
869 * @param cls the OverlayConnectData
870 * @param message the reply message to the suboperation
871 */
872static void
873overlay_connect_ondemand_handler (void *cls,
874 const struct GNUNET_MessageHeader *message)
875{
876 struct OverlayConnectData *oc_data = cls;
877
878 switch (oc_data->state)
879 {
880 case OCD_CFG_ACQUIRE:
881 {
882 struct GNUNET_CONFIGURATION_Handle *cfg;
883
884 if (GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG != ntohs (message->type))
885 {
886 GNUNET_break (0); /* treat operation as failed */
887 }
888 cfg = GNUNET_TESTBED_extract_config_ (message);
889 if (NULL == cfg)
890 {
891 GNUNET_break (0); /* failed operation */
892 }
893 oc_data->state = OCD_LINK_CONTROLLERS;
894 }
895 default:
896 GNUNET_assert (0);
897 }
898}
899
900
901/**
902 * Handler for GNUNET_MESSAGE_TYPE_TESTBED_NEEDCONTROLLERCONFIG message from
903 * controller (testbed service)
904 *
905 * @param c the controller handler
906 * @param msg message received
907 * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
908 * not
909 */
910static int
911handle_need_controller_config (struct GNUNET_TESTBED_Controller *c,
912 const struct GNUNET_TESTBED_NeedControllerConfig * msg)
913{
914 struct OperationContext *opc;
915 struct OverlayConnectData *oc_data;
916 uint64_t op_id;
917
918 op_id = GNUNET_ntohll (msg->operation_id);
919 if (NULL == (opc = find_opc (c, op_id)))
920 {
921 LOG_DEBUG ("Operation not found\n");
922 return GNUNET_YES;
923 }
924 if (OP_FORWARDED == opc->type)
925 {
926 handle_forwarded_operation_msg (c, opc,
927 (const struct GNUNET_MessageHeader *) msg);
928 return GNUNET_YES;
929 }
930 GNUNET_assert (OP_OVERLAY_CONNECT == opc->type);
931 oc_data = opc->data;
932 /* FIXME: Should spawn operations to:
933 1. Acquire configuration of peer2's controller,
934 2. link peer1's controller to peer2's controller
935 3. ask them to attempt overlay connect on peer1 and peer2 again */
936 switch (oc_data->state)
937 {
938 case OCD_INIT:
939 {
940 struct GNUNET_TESTBED_SlaveGetConfigurationMessage *get_cfg_msg;
941 uint64_t sub_op_id;
942
943 GNUNET_assert (NULL == oc_data->sub_opc);
944 sub_op_id = GNUNET_TESTBED_get_next_op_id (oc_data->p1->controller);
945 get_cfg_msg =
946 GNUNET_TESTBED_generate_slavegetconfig_msg_
947 (sub_op_id, GNUNET_TESTBED_host_get_id_ (oc_data->p2->host));
948 oc_data->state = OCD_CFG_ACQUIRE;
949 oc_data->sub_opc =
950 GNUNET_TESTBED_forward_operation_msg_ (oc_data->p1->controller,
951 sub_op_id, &get_cfg_msg->header,
952 overlay_connect_ondemand_handler,
953 oc_data);
954 }
955 break;
956 default:
957 GNUNET_assert (0);
958 }
959 return GNUNET_YES;
960}
961
962
963/**
964 * Handler for messages from controller (testbed service) 867 * Handler for messages from controller (testbed service)
965 * 868 *
966 * @param cls the controller handler 869 * @param cls the controller handler
@@ -1054,14 +957,6 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
1054 handle_slave_config (c, (const struct 957 handle_slave_config (c, (const struct
1055 GNUNET_TESTBED_SlaveConfiguration *) msg); 958 GNUNET_TESTBED_SlaveConfiguration *) msg);
1056 break; 959 break;
1057 case GNUNET_MESSAGE_TYPE_TESTBED_NEEDCONTROLLERCONFIG:
1058 GNUNET_assert (msize == sizeof (struct
1059 GNUNET_TESTBED_NeedControllerConfig));
1060 status =
1061 handle_need_controller_config (c, (const struct
1062 GNUNET_TESTBED_NeedControllerConfig
1063 *) msg);
1064 break;
1065 default: 960 default:
1066 GNUNET_assert (0); 961 GNUNET_assert (0);
1067 } 962 }