diff options
Diffstat (limited to 'src/testbed/testbed_api_hosts.c')
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 26d2553e0..d0a460fe6 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -56,7 +56,7 @@ | |||
56 | do \ | 56 | do \ |
57 | { \ | 57 | { \ |
58 | if (cond) \ | 58 | if (cond) \ |
59 | break; \ | 59 | break; \ |
60 | LOG (GNUNET_ERROR_TYPE_ERROR, "API violation detected: %s\n", errstr); \ | 60 | LOG (GNUNET_ERROR_TYPE_ERROR, "API violation detected: %s\n", errstr); \ |
61 | GNUNET_assert (0); \ | 61 | GNUNET_assert (0); \ |
62 | } while (0) | 62 | } while (0) |
@@ -964,22 +964,10 @@ gen_rsh_suffix_args (const char *const *append_args) | |||
964 | } | 964 | } |
965 | 965 | ||
966 | 966 | ||
967 | /** | 967 | void |
968 | * Functions with this signature are called whenever a | 968 | GNUNET_TESTBED_extract_cfg (struct GNUNET_TESTBED_Host *host, const struct |
969 | * complete message is received by the tokenizer. | 969 | GNUNET_MessageHeader *message) |
970 | * | ||
971 | * Do not call GNUNET_SERVER_mst_destroy in callback | ||
972 | * | ||
973 | * @param cls closure | ||
974 | * @param client identification of the client | ||
975 | * @param message the actual message | ||
976 | * | ||
977 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing | ||
978 | */ | ||
979 | static int | ||
980 | helper_mst (void *cls, const struct GNUNET_MessageHeader *message) | ||
981 | { | 970 | { |
982 | struct GNUNET_TESTBED_ControllerProc *cp = cls; | ||
983 | const struct GNUNET_TESTBED_HelperReply *msg; | 971 | const struct GNUNET_TESTBED_HelperReply *msg; |
984 | const char *hostname; | 972 | const char *hostname; |
985 | char *config; | 973 | char *config; |
@@ -1001,22 +989,43 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) | |||
1001 | xconfig_size)); | 989 | xconfig_size)); |
1002 | /* Replace the configuration template present in the host with the | 990 | /* Replace the configuration template present in the host with the |
1003 | controller's running configuration */ | 991 | controller's running configuration */ |
1004 | GNUNET_CONFIGURATION_destroy (cp->host->cfg); | 992 | GNUNET_CONFIGURATION_destroy (host->cfg); |
1005 | cp->host->cfg = GNUNET_CONFIGURATION_create (); | 993 | host->cfg = GNUNET_CONFIGURATION_create (); |
1006 | GNUNET_assert (GNUNET_CONFIGURATION_deserialize (cp->host->cfg, | 994 | GNUNET_assert (GNUNET_CONFIGURATION_deserialize (host->cfg, |
1007 | config, | 995 | config, |
1008 | config_size, | 996 | config_size, |
1009 | NULL)); | 997 | NULL)); |
1010 | GNUNET_free (config); | 998 | GNUNET_free (config); |
1011 | if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host))) | 999 | if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (host))) |
1012 | hostname = "localhost"; | 1000 | hostname = "localhost"; |
1013 | /* Change the hostname so that we can connect to it */ | 1001 | /* Change the hostname so that we can connect to it */ |
1014 | GNUNET_CONFIGURATION_set_value_string (cp->host->cfg, | 1002 | GNUNET_CONFIGURATION_set_value_string (host->cfg, |
1015 | "testbed", | 1003 | "testbed", |
1016 | "hostname", | 1004 | "hostname", |
1017 | hostname); | 1005 | hostname); |
1018 | cp->host->locked = GNUNET_NO; | 1006 | host->locked = GNUNET_NO; |
1019 | cp->host->controller_started = GNUNET_YES; | 1007 | } |
1008 | |||
1009 | /** | ||
1010 | * Functions with this signature are called whenever a | ||
1011 | * complete message is received by the tokenizer. | ||
1012 | * | ||
1013 | * Do not call GNUNET_SERVER_mst_destroy in callback | ||
1014 | * | ||
1015 | * @param cls closure | ||
1016 | * @param client identification of the client | ||
1017 | * @param message the actual message | ||
1018 | * | ||
1019 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing | ||
1020 | */ | ||
1021 | static int | ||
1022 | helper_mst (void *cls, const struct GNUNET_MessageHeader *message) | ||
1023 | { | ||
1024 | struct GNUNET_TESTBED_ControllerProc *cp = cls; | ||
1025 | struct GNUNET_TESTBED_Host *host = cp->host; | ||
1026 | |||
1027 | GNUNET_TESTBED_extract_cfg (host, message); | ||
1028 | |||
1020 | cp->cb (cp->cls, cp->host->cfg, GNUNET_OK); | 1029 | cp->cb (cp->cls, cp->host->cfg, GNUNET_OK); |
1021 | return GNUNET_OK; | 1030 | return GNUNET_OK; |
1022 | } | 1031 | } |
@@ -1323,7 +1332,7 @@ habitability_check (void *cls) | |||
1323 | h->auxp = NULL; | 1332 | h->auxp = NULL; |
1324 | ret = (0 != code) ? GNUNET_NO : GNUNET_YES; | 1333 | ret = (0 != code) ? GNUNET_NO : GNUNET_YES; |
1325 | 1334 | ||
1326 | call_cb: | 1335 | call_cb: |
1327 | if (NULL != h->auxp) | 1336 | if (NULL != h->auxp) |
1328 | GNUNET_OS_process_destroy (h->auxp); | 1337 | GNUNET_OS_process_destroy (h->auxp); |
1329 | cb = h->cb; | 1338 | cb = h->cb; |