aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_hosts.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/testbed_api_hosts.c')
-rw-r--r--src/testbed/testbed_api_hosts.c53
1 files changed, 22 insertions, 31 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index d0a460fe6..1a8d9976d 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -964,10 +964,22 @@ gen_rsh_suffix_args (const char *const *append_args)
964} 964}
965 965
966 966
967void 967/**
968GNUNET_TESTBED_extract_cfg (struct GNUNET_TESTBED_Host *host, const struct 968 * Functions with this signature are called whenever a
969 GNUNET_MessageHeader *message) 969 * complete message is received by the tokenizer.
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 */
979static int
980helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
970{ 981{
982 struct GNUNET_TESTBED_ControllerProc *cp = cls;
971 const struct GNUNET_TESTBED_HelperReply *msg; 983 const struct GNUNET_TESTBED_HelperReply *msg;
972 const char *hostname; 984 const char *hostname;
973 char *config; 985 char *config;
@@ -989,43 +1001,22 @@ GNUNET_TESTBED_extract_cfg (struct GNUNET_TESTBED_Host *host, const struct
989 xconfig_size)); 1001 xconfig_size));
990 /* Replace the configuration template present in the host with the 1002 /* Replace the configuration template present in the host with the
991 controller's running configuration */ 1003 controller's running configuration */
992 GNUNET_CONFIGURATION_destroy (host->cfg); 1004 GNUNET_CONFIGURATION_destroy (cp->host->cfg);
993 host->cfg = GNUNET_CONFIGURATION_create (); 1005 cp->host->cfg = GNUNET_CONFIGURATION_create ();
994 GNUNET_assert (GNUNET_CONFIGURATION_deserialize (host->cfg, 1006 GNUNET_assert (GNUNET_CONFIGURATION_deserialize (cp->host->cfg,
995 config, 1007 config,
996 config_size, 1008 config_size,
997 NULL)); 1009 NULL));
998 GNUNET_free (config); 1010 GNUNET_free (config);
999 if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (host))) 1011 if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host)))
1000 hostname = "localhost"; 1012 hostname = "localhost";
1001 /* Change the hostname so that we can connect to it */ 1013 /* Change the hostname so that we can connect to it */
1002 GNUNET_CONFIGURATION_set_value_string (host->cfg, 1014 GNUNET_CONFIGURATION_set_value_string (cp->host->cfg,
1003 "testbed", 1015 "testbed",
1004 "hostname", 1016 "hostname",
1005 hostname); 1017 hostname);
1006 host->locked = GNUNET_NO; 1018 cp->host->locked = GNUNET_NO;
1007} 1019 cp->host->controller_started = GNUNET_YES;
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 */
1021static int
1022helper_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
1029 cp->cb (cp->cls, cp->host->cfg, GNUNET_OK); 1020 cp->cb (cp->cls, cp->host->cfg, GNUNET_OK);
1030 return GNUNET_OK; 1021 return GNUNET_OK;
1031} 1022}