diff options
Diffstat (limited to 'src/testbed/testbed_api_testbed.c')
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 221 |
1 files changed, 106 insertions, 115 deletions
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 24f17bc75..3177f8df8 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c | |||
@@ -156,7 +156,7 @@ struct RunContext | |||
156 | * TestMaster callback to call when testbed initialization is done | 156 | * TestMaster callback to call when testbed initialization is done |
157 | */ | 157 | */ |
158 | GNUNET_TESTBED_TestMaster test_master; | 158 | GNUNET_TESTBED_TestMaster test_master; |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * The closure for the TestMaster callback | 161 | * The closure for the TestMaster callback |
162 | */ | 162 | */ |
@@ -275,7 +275,7 @@ struct RunContext | |||
275 | * Number of random links to established | 275 | * Number of random links to established |
276 | */ | 276 | */ |
277 | unsigned int random_links; | 277 | unsigned int random_links; |
278 | 278 | ||
279 | }; | 279 | }; |
280 | 280 | ||
281 | 281 | ||
@@ -394,7 +394,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
394 | if (NULL != rc->h) | 394 | if (NULL != rc->h) |
395 | GNUNET_TESTBED_host_destroy (rc->h); | 395 | GNUNET_TESTBED_host_destroy (rc->h); |
396 | for (hid = 0; hid < rc->num_hosts; hid++) | 396 | for (hid = 0; hid < rc->num_hosts; hid++) |
397 | GNUNET_TESTBED_host_destroy (rc->hosts[hid]); | 397 | GNUNET_TESTBED_host_destroy (rc->hosts[hid]); |
398 | GNUNET_free_non_null (rc->hosts); | 398 | GNUNET_free_non_null (rc->hosts); |
399 | if (NULL != rc->cfg) | 399 | if (NULL != rc->cfg) |
400 | GNUNET_CONFIGURATION_destroy (rc->cfg); | 400 | GNUNET_CONFIGURATION_destroy (rc->cfg); |
@@ -530,7 +530,7 @@ shutdown_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
530 | return; | 530 | return; |
531 | GNUNET_free (rc->peers); | 531 | GNUNET_free (rc->peers); |
532 | rc->peers = NULL; | 532 | rc->peers = NULL; |
533 | } | 533 | } |
534 | } | 534 | } |
535 | rc->state = RC_PEERS_DESTROYED; /* No peers are present so we consider the | 535 | rc->state = RC_PEERS_DESTROYED; /* No peers are present so we consider the |
536 | * state where all peers are destroyed */ | 536 | * state where all peers are destroyed */ |
@@ -548,11 +548,11 @@ static void | |||
548 | call_master (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 548 | call_master (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
549 | { | 549 | { |
550 | struct RunContext *rc = cls; | 550 | struct RunContext *rc = cls; |
551 | 551 | ||
552 | if (NULL != rc->topology_operation) | 552 | if (NULL != rc->topology_operation) |
553 | { | 553 | { |
554 | DEBUG ("Overlay topology generated in %s\n", prof_time (rc)); | 554 | DEBUG ("Overlay topology generated in %s\n", prof_time (rc)); |
555 | GNUNET_TESTBED_operation_done (rc->topology_operation); | 555 | GNUNET_TESTBED_operation_done (rc->topology_operation); |
556 | rc->topology_operation = NULL; | 556 | rc->topology_operation = NULL; |
557 | } | 557 | } |
558 | if (NULL != rc->test_master) | 558 | if (NULL != rc->test_master) |
@@ -570,7 +570,7 @@ create_peers (struct RunContext *rc) | |||
570 | { | 570 | { |
571 | struct DLLOperation *dll_op; | 571 | struct DLLOperation *dll_op; |
572 | unsigned int peer; | 572 | unsigned int peer; |
573 | 573 | ||
574 | DEBUG ("Creating peers\n"); | 574 | DEBUG ("Creating peers\n"); |
575 | rc->pstart_time = GNUNET_TIME_absolute_get (); | 575 | rc->pstart_time = GNUNET_TIME_absolute_get (); |
576 | rc->peers = | 576 | rc->peers = |
@@ -582,11 +582,11 @@ create_peers (struct RunContext *rc) | |||
582 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); | 582 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); |
583 | dll_op->rc = rc; | 583 | dll_op->rc = rc; |
584 | dll_op->op = | 584 | dll_op->op = |
585 | GNUNET_TESTBED_peer_create (rc->c, | 585 | GNUNET_TESTBED_peer_create (rc->c, |
586 | (0 == rc->num_hosts) | 586 | (0 == |
587 | ? rc->h : rc->hosts[peer % rc->num_hosts], | 587 | rc->num_hosts) ? rc->h : rc->hosts[peer % |
588 | rc->cfg, | 588 | rc->num_hosts], |
589 | peer_create_cb, dll_op); | 589 | rc->cfg, peer_create_cb, dll_op); |
590 | GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op); | 590 | GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op); |
591 | } | 591 | } |
592 | } | 592 | } |
@@ -614,8 +614,7 @@ event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
614 | dll_op = event->details.operation_finished.op_cls; | 614 | dll_op = event->details.operation_finished.op_cls; |
615 | if (NULL != event->details.operation_finished.emsg) | 615 | if (NULL != event->details.operation_finished.emsg) |
616 | { | 616 | { |
617 | LOG (GNUNET_ERROR_TYPE_ERROR, | 617 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Linking controllers failed. Exiting")); |
618 | _("Linking controllers failed. Exiting")); | ||
619 | shutdown_now (rc); | 618 | shutdown_now (rc); |
620 | } | 619 | } |
621 | else | 620 | else |
@@ -719,20 +718,17 @@ call_cc: | |||
719 | GNUNET_free (dll_op); | 718 | GNUNET_free (dll_op); |
720 | rc->peer_count++; | 719 | rc->peer_count++; |
721 | if (rc->peer_count < rc->num_peers) | 720 | if (rc->peer_count < rc->num_peers) |
722 | return; | 721 | return; |
723 | DEBUG ("%u peers started in %s\n", rc->num_peers, | 722 | DEBUG ("%u peers started in %s\n", rc->num_peers, prof_time (rc)); |
724 | prof_time (rc)); | ||
725 | if (GNUNET_TESTBED_TOPOLOGY_NONE != rc->topology) | 723 | if (GNUNET_TESTBED_TOPOLOGY_NONE != rc->topology) |
726 | { | 724 | { |
727 | if ( (GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI == rc->topology) | 725 | if ((GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI == rc->topology) || |
728 | || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology) | 726 | (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology) || |
729 | || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology)) | 727 | (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology)) |
730 | { | 728 | { |
731 | rc->topology_operation = | 729 | rc->topology_operation = |
732 | GNUNET_TESTBED_overlay_configure_topology (NULL, | 730 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, |
733 | rc->num_peers, | 731 | rc->peers, &rc->num_oc, |
734 | rc->peers, | ||
735 | &rc->num_oc, | ||
736 | rc->topology, | 732 | rc->topology, |
737 | rc->random_links, | 733 | rc->random_links, |
738 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 734 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
@@ -741,20 +737,16 @@ call_cc: | |||
741 | { | 737 | { |
742 | GNUNET_assert (NULL != rc->topo_file); | 738 | GNUNET_assert (NULL != rc->topo_file); |
743 | rc->topology_operation = | 739 | rc->topology_operation = |
744 | GNUNET_TESTBED_overlay_configure_topology (NULL, | 740 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, |
745 | rc->num_peers, | 741 | rc->peers, &rc->num_oc, |
746 | rc->peers, | ||
747 | &rc->num_oc, | ||
748 | rc->topology, | 742 | rc->topology, |
749 | rc->topo_file, | 743 | rc->topo_file, |
750 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 744 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
751 | } | 745 | } |
752 | else | 746 | else |
753 | rc->topology_operation = | 747 | rc->topology_operation = |
754 | GNUNET_TESTBED_overlay_configure_topology (NULL, | 748 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, |
755 | rc->num_peers, | 749 | rc->peers, &rc->num_oc, |
756 | rc->peers, | ||
757 | &rc->num_oc, | ||
758 | rc->topology, | 750 | rc->topology, |
759 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 751 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
760 | if (NULL == rc->topology_operation) | 752 | if (NULL == rc->topology_operation) |
@@ -763,7 +755,7 @@ call_cc: | |||
763 | else | 755 | else |
764 | { | 756 | { |
765 | DEBUG ("Creating overlay topology\n"); | 757 | DEBUG ("Creating overlay topology\n"); |
766 | rc->pstart_time = GNUNET_TIME_absolute_get (); | 758 | rc->pstart_time = GNUNET_TIME_absolute_get (); |
767 | return; | 759 | return; |
768 | } | 760 | } |
769 | } | 761 | } |
@@ -828,21 +820,18 @@ register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
828 | { | 820 | { |
829 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); | 821 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); |
830 | dll_op->rc = rc; | 822 | dll_op->rc = rc; |
831 | dll_op->op = GNUNET_TESTBED_controller_link (dll_op, | 823 | dll_op->op = |
832 | rc->c, | 824 | GNUNET_TESTBED_controller_link (dll_op, rc->c, rc->hosts[slave], |
833 | rc->hosts[slave], | 825 | rc->h, rc->cfg, GNUNET_YES); |
834 | rc->h, | 826 | GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, |
835 | rc->cfg, | 827 | dll_op); |
836 | GNUNET_YES); | ||
837 | GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op); | ||
838 | } | 828 | } |
839 | rc->reg_hosts = 0; | 829 | rc->reg_hosts = 0; |
840 | return; | 830 | return; |
841 | } | 831 | } |
842 | rc->reg_handle = GNUNET_TESTBED_register_host (rc->c, | 832 | rc->reg_handle = |
843 | rc->hosts[rc->reg_hosts++], | 833 | GNUNET_TESTBED_register_host (rc->c, rc->hosts[rc->reg_hosts++], |
844 | host_registration_completion, | 834 | host_registration_completion, rc); |
845 | rc); | ||
846 | } | 835 | } |
847 | 836 | ||
848 | 837 | ||
@@ -871,7 +860,7 @@ controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
871 | return; | 860 | return; |
872 | default: | 861 | default: |
873 | rc->cproc = NULL; | 862 | rc->cproc = NULL; |
874 | shutdown_now (rc); | 863 | shutdown_now (rc); |
875 | return; | 864 | return; |
876 | } | 865 | } |
877 | } | 866 | } |
@@ -884,7 +873,8 @@ controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
884 | if (rc->topology < GNUNET_TESTBED_TOPOLOGY_NONE) | 873 | if (rc->topology < GNUNET_TESTBED_TOPOLOGY_NONE) |
885 | event_mask |= GNUNET_TESTBED_ET_CONNECT; | 874 | event_mask |= GNUNET_TESTBED_ET_CONNECT; |
886 | rc->c = | 875 | rc->c = |
887 | GNUNET_TESTBED_controller_connect (rc->cfg, rc->h, event_mask, &event_cb, rc); | 876 | GNUNET_TESTBED_controller_connect (rc->cfg, rc->h, event_mask, &event_cb, |
877 | rc); | ||
888 | if (0 < rc->num_hosts) | 878 | if (0 < rc->num_hosts) |
889 | { | 879 | { |
890 | rc->register_hosts_task = GNUNET_SCHEDULER_add_now (®ister_hosts, rc); | 880 | rc->register_hosts_task = GNUNET_SCHEDULER_add_now (®ister_hosts, rc); |
@@ -908,32 +898,28 @@ controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
908 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | 898 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort |
909 | */ | 899 | */ |
910 | static int | 900 | static int |
911 | netint_proc (void *cls, const char *name, | 901 | netint_proc (void *cls, const char *name, int isDefault, |
912 | int isDefault, | 902 | const struct sockaddr *addr, const struct sockaddr *broadcast_addr, |
913 | const struct sockaddr *addr, | 903 | const struct sockaddr *netmask, socklen_t addrlen) |
914 | const struct sockaddr *broadcast_addr, | ||
915 | const struct sockaddr *netmask, | ||
916 | socklen_t addrlen) | ||
917 | { | 904 | { |
918 | struct RunContext *rc = cls; | 905 | struct RunContext *rc = cls; |
919 | char hostip[NI_MAXHOST]; | 906 | char hostip[NI_MAXHOST]; |
920 | char *buf; | 907 | char *buf; |
921 | 908 | ||
922 | if (sizeof (struct sockaddr_in) != addrlen) | 909 | if (sizeof (struct sockaddr_in) != addrlen) |
923 | return GNUNET_OK; /* Only consider IPv4 for now */ | 910 | return GNUNET_OK; /* Only consider IPv4 for now */ |
924 | if (0 != getnameinfo(addr, addrlen, | 911 | if (0 != |
925 | hostip, NI_MAXHOST, | 912 | getnameinfo (addr, addrlen, hostip, NI_MAXHOST, NULL, 0, NI_NUMERICHOST)) |
926 | NULL, 0, NI_NUMERICHOST)) | 913 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "getnameinfo"); |
927 | GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "getnameinfo"); | 914 | if (NULL == rc->trusted_ip) |
928 | if (NULL == rc->trusted_ip) | 915 | { |
929 | { | 916 | rc->trusted_ip = GNUNET_strdup (hostip); |
930 | rc->trusted_ip = GNUNET_strdup (hostip); | 917 | return GNUNET_YES; |
931 | return GNUNET_YES; | 918 | } |
932 | } | 919 | (void) GNUNET_asprintf (&buf, "%s; %s", rc->trusted_ip, hostip); |
933 | (void) GNUNET_asprintf (&buf, "%s; %s", rc->trusted_ip, hostip); | 920 | GNUNET_free (rc->trusted_ip); |
934 | GNUNET_free (rc->trusted_ip); | 921 | rc->trusted_ip = buf; |
935 | rc->trusted_ip = buf; | 922 | return GNUNET_YES; |
936 | return GNUNET_YES; | ||
937 | } | 923 | } |
938 | 924 | ||
939 | 925 | ||
@@ -947,12 +933,13 @@ netint_proc (void *cls, const char *name, | |||
947 | * given to GNUNET_TESTBED_is_host_habitable() is NULL | 933 | * given to GNUNET_TESTBED_is_host_habitable() is NULL |
948 | * @param status GNUNET_YES if it is habitable; GNUNET_NO if not | 934 | * @param status GNUNET_YES if it is habitable; GNUNET_NO if not |
949 | */ | 935 | */ |
950 | static void | 936 | static void |
951 | host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status) | 937 | host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, |
938 | int status) | ||
952 | { | 939 | { |
953 | struct RunContext *rc = cls; | 940 | struct RunContext *rc = cls; |
954 | unsigned int nhost; | 941 | unsigned int nhost; |
955 | 942 | ||
956 | for (nhost = 0; nhost < rc->num_hosts; nhost++) | 943 | for (nhost = 0; nhost < rc->num_hosts; nhost++) |
957 | { | 944 | { |
958 | if (host == rc->hosts[nhost]) | 945 | if (host == rc->hosts[nhost]) |
@@ -966,7 +953,8 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status | |||
966 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), | 953 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), |
967 | GNUNET_TESTBED_host_get_hostname (host)); | 954 | GNUNET_TESTBED_host_get_hostname (host)); |
968 | else | 955 | else |
969 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); | 956 | LOG (GNUNET_ERROR_TYPE_ERROR, |
957 | _("Testbed cannot be started on localhost\n")); | ||
970 | shutdown_now (rc); | 958 | shutdown_now (rc); |
971 | return; | 959 | return; |
972 | } | 960 | } |
@@ -1040,7 +1028,7 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
1040 | unsigned long long random_links; | 1028 | unsigned long long random_links; |
1041 | unsigned int hid; | 1029 | unsigned int hid; |
1042 | unsigned int nhost; | 1030 | unsigned int nhost; |
1043 | 1031 | ||
1044 | GNUNET_assert (num_peers > 0); | 1032 | GNUNET_assert (num_peers > 0); |
1045 | rc = GNUNET_malloc (sizeof (struct RunContext)); | 1033 | rc = GNUNET_malloc (sizeof (struct RunContext)); |
1046 | if (NULL != host_filename) | 1034 | if (NULL != host_filename) |
@@ -1064,17 +1052,17 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
1064 | rc->test_master = test_master; | 1052 | rc->test_master = test_master; |
1065 | rc->test_master_cls = test_master_cls; | 1053 | rc->test_master_cls = test_master_cls; |
1066 | rc->state = RC_INIT; | 1054 | rc->state = RC_INIT; |
1067 | rc->topology = GNUNET_TESTBED_TOPOLOGY_NONE; | 1055 | rc->topology = GNUNET_TESTBED_TOPOLOGY_NONE; |
1068 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (rc->cfg, "testbed", | 1056 | if (GNUNET_OK == |
1069 | "OVERLAY_TOPOLOGY", | 1057 | GNUNET_CONFIGURATION_get_value_string (rc->cfg, "testbed", |
1070 | &topology)) | 1058 | "OVERLAY_TOPOLOGY", &topology)) |
1071 | { | 1059 | { |
1072 | if (GNUNET_NO == GNUNET_TESTBED_topology_get_ (&rc->topology, | 1060 | if (GNUNET_NO == GNUNET_TESTBED_topology_get_ (&rc->topology, topology)) |
1073 | topology)) | ||
1074 | { | 1061 | { |
1075 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | 1062 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "testbed", |
1076 | "testbed", "OVERLAY_TOPLOGY", | 1063 | "OVERLAY_TOPLOGY", |
1077 | _("Specified topology must be supported by testbed")); | 1064 | _ |
1065 | ("Specified topology must be supported by testbed")); | ||
1078 | } | 1066 | } |
1079 | GNUNET_free (topology); | 1067 | GNUNET_free (topology); |
1080 | } | 1068 | } |
@@ -1083,51 +1071,54 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
1083 | case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI: | 1071 | case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI: |
1084 | case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING: | 1072 | case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING: |
1085 | case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD: | 1073 | case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD: |
1086 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (rc->cfg, "testbed", | 1074 | if (GNUNET_OK != |
1087 | "OVERLAY_RANDOM_LINKS", | 1075 | GNUNET_CONFIGURATION_get_value_number (rc->cfg, "testbed", |
1088 | &random_links)) | 1076 | "OVERLAY_RANDOM_LINKS", |
1077 | &random_links)) | ||
1089 | { | 1078 | { |
1090 | /* OVERLAY option RANDOM & SMALL_WORLD_RING requires OVERLAY_RANDOM_LINKS | 1079 | /* OVERLAY option RANDOM & SMALL_WORLD_RING requires OVERLAY_RANDOM_LINKS |
1091 | option to be set to the number of random links to be established */ | 1080 | * option to be set to the number of random links to be established */ |
1092 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | 1081 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "testbed", |
1093 | "testbed", "OVERLAY_RANDOM_LINKS"); | 1082 | "OVERLAY_RANDOM_LINKS"); |
1094 | goto error_cleanup; | 1083 | goto error_cleanup; |
1095 | } | 1084 | } |
1096 | if (random_links > UINT32_MAX) | 1085 | if (random_links > UINT32_MAX) |
1097 | { | 1086 | { |
1098 | GNUNET_break (0); /* Too big number */ | 1087 | GNUNET_break (0); /* Too big number */ |
1099 | goto error_cleanup; | 1088 | goto error_cleanup; |
1100 | } | 1089 | } |
1101 | rc->random_links = (unsigned int) random_links; | 1090 | rc->random_links = (unsigned int) random_links; |
1102 | break; | 1091 | break; |
1103 | case GNUNET_TESTBED_TOPOLOGY_FROM_FILE: | 1092 | case GNUNET_TESTBED_TOPOLOGY_FROM_FILE: |
1104 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (rc->cfg, "testbed", | 1093 | if (GNUNET_OK != |
1105 | "OVERLAY_TOPOLOGY_FILE", | 1094 | GNUNET_CONFIGURATION_get_value_string (rc->cfg, "testbed", |
1106 | &rc->topo_file)) | 1095 | "OVERLAY_TOPOLOGY_FILE", |
1096 | &rc->topo_file)) | ||
1107 | { | 1097 | { |
1108 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | 1098 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "testbed", |
1109 | "testbed", "OVERLAY_TOPOLOGY_FILE"); | 1099 | "OVERLAY_TOPOLOGY_FILE"); |
1110 | goto error_cleanup; | 1100 | goto error_cleanup; |
1111 | } | 1101 | } |
1112 | default: | 1102 | default: |
1113 | /* Warn if OVERLAY_RANDOM_LINKS is present that it will be ignored */ | 1103 | /* Warn if OVERLAY_RANDOM_LINKS is present that it will be ignored */ |
1114 | if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (rc->cfg, "testbed", | 1104 | if (GNUNET_YES == |
1115 | "OVERLAY_RANDOM_LINKS")) | 1105 | GNUNET_CONFIGURATION_have_value (rc->cfg, "testbed", |
1106 | "OVERLAY_RANDOM_LINKS")) | ||
1116 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1107 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1117 | "Ignoring value of `OVERLAY_RANDOM_LINKS' in given configuration\n"); | 1108 | "Ignoring value of `OVERLAY_RANDOM_LINKS' in given configuration\n"); |
1118 | break; | 1109 | break; |
1119 | } | 1110 | } |
1120 | if (NULL != host_filename) | 1111 | if (NULL != host_filename) |
1121 | { | 1112 | { |
1122 | rc->hc_handles = GNUNET_malloc (sizeof (struct | 1113 | rc->hc_handles = |
1123 | GNUNET_TESTBED_HostHabitableCheckHandle *) | 1114 | GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostHabitableCheckHandle *) |
1124 | * rc->num_hosts); | 1115 | * rc->num_hosts); |
1125 | for (nhost = 0; nhost < rc->num_hosts; nhost++) | 1116 | for (nhost = 0; nhost < rc->num_hosts; nhost++) |
1126 | { | 1117 | { |
1127 | if (NULL == (rc->hc_handles[nhost] = | 1118 | if (NULL == |
1128 | GNUNET_TESTBED_is_host_habitable (rc->hosts[nhost], rc->cfg, | 1119 | (rc->hc_handles[nhost] = |
1129 | &host_habitable_cb, | 1120 | GNUNET_TESTBED_is_host_habitable (rc->hosts[nhost], rc->cfg, |
1130 | rc))) | 1121 | &host_habitable_cb, rc))) |
1131 | { | 1122 | { |
1132 | GNUNET_break (0); | 1123 | GNUNET_break (0); |
1133 | for (nhost = 0; nhost < rc->num_hosts; nhost++) | 1124 | for (nhost = 0; nhost < rc->num_hosts; nhost++) |
@@ -1141,14 +1132,14 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
1141 | } | 1132 | } |
1142 | else | 1133 | else |
1143 | rc->cproc = | 1134 | rc->cproc = |
1144 | GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h, rc->cfg, | 1135 | GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h, rc->cfg, |
1145 | &controller_status_cb, rc); | 1136 | &controller_status_cb, rc); |
1146 | rc->shutdown_run_task = | 1137 | rc->shutdown_run_task = |
1147 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 1138 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_run, |
1148 | &shutdown_run, rc); | 1139 | rc); |
1149 | return; | 1140 | return; |
1150 | 1141 | ||
1151 | error_cleanup: | 1142 | error_cleanup: |
1152 | if (NULL != rc->h) | 1143 | if (NULL != rc->h) |
1153 | GNUNET_TESTBED_host_destroy (rc->h); | 1144 | GNUNET_TESTBED_host_destroy (rc->h); |
1154 | if (NULL != rc->hosts) | 1145 | if (NULL != rc->hosts) |