From: Christian Grothoff Date: Wed, 11 Jul 2012 13:10:26 +0000 (+0000) Subject: -breaking testbed again... X-Git-Tag: initial-import-from-subversion-38251~12543 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=adc0e2a714e9a59f801ef2d93daa7f8fcb3091f8;p=oweals%2Fgnunet.git -breaking testbed again... --- diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index e6997db1f..46be98b79 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h @@ -401,14 +401,40 @@ typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls, struct GNUNET_TESTBED_ControllerProc; +/** + * Function called on errors with the controller. + * + * @param cls closure + * @param emsg error message if available; can be NULL, which does NOT mean + * that there was no error + */ +typedef void (*GNUNET_TESTBED_ControllerErrorCallback)(void *cls, + const char *emsg); + + /** * Starts a controller process at the host * + * @param system used for reserving ports if host is NULL and to determine + * which 'host' to set as TRUSTED ('controller') when starting testbed remotely * @param host the host where the controller has to be started; NULL for localhost - * @return the controller process handle + * @param cfg template configuration to use for the remote controller; will + * be modified to contain the actual host/port/unixpath used for + * the testbed service + * @param cec function called if the contoller dies unexpectedly; will not be + * invoked after GNUNET_TESTBED_controller_stop, if 'cec' was called, + * GNUNET_TESTBED_controller_stop must no longer be called; will + * never be called in the same task as 'GNUNET_TESTBED_controller_start' + * (synchronous errors will be signalled by returning NULL) + * @param cec_cls closure for 'cec' + * @return the controller process handle, NULL on errors */ struct GNUNET_TESTBED_ControllerProc * -GNUNET_TESTBED_controller_start (struct GNUNET_TESTBED_Host *host); +GNUNET_TESTBED_controller_start (struct GNUNET_TESTING_System *system, + struct GNUNET_TESTBED_Host *host, + struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_TESTBED_ControllerErrorCallback cec, + void *cec_cls); /** diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index 6c50c93d7..1fdb7169a 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c @@ -182,11 +182,13 @@ run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *config) { uint64_t event_mask; + struct GNUNET_CONFIGURATION_Handle *cdup; cfg = config; host = GNUNET_TESTBED_host_create (NULL, NULL, 0); GNUNET_assert (NULL != host); - cp = GNUNET_TESTBED_controller_start (host); + cdup = GNUNET_CONFIGURATION_dup (config); + cp = GNUNET_TESTBED_controller_start (system, host, cdup, NULL, NULL); event_mask = 0; event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);