lightningd: rename 'daemons' to 'subdaemons'.

We're a daemon.  They're subdaemons.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-09-03 10:12:27 +09:30
parent 1e91523663
commit c33c971478
3 changed files with 17 additions and 16 deletions

View File

@ -87,7 +87,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
return ld;
}
static const char *daemons[] = {
static const char *subdaemons[] = {
"lightning_channeld",
"lightning_closingd",
"lightning_connectd",
@ -98,12 +98,12 @@ static const char *daemons[] = {
};
/* Check we can run them, and check their versions */
void test_daemons(const struct lightningd *ld)
void test_subdaemons(const struct lightningd *ld)
{
size_t i;
for (i = 0; i < ARRAY_SIZE(daemons); i++) {
for (i = 0; i < ARRAY_SIZE(subdaemons); i++) {
int outfd;
const char *dpath = path_join(tmpctx, ld->daemon_dir, daemons[i]);
const char *dpath = path_join(tmpctx, ld->daemon_dir, subdaemons[i]);
const char *verstring;
pid_t pid = pipecmd(&outfd, NULL, &outfd,
dpath, "--version", NULL);
@ -116,17 +116,18 @@ void test_daemons(const struct lightningd *ld)
err(1, "Could not get output from %s", dpath);
if (!strstarts(verstring, version())
|| verstring[strlen(version())] != '\n')
errx(1, "%s: bad version '%s'", daemons[i], verstring);
errx(1, "%s: bad version '%s'",
subdaemons[i], verstring);
}
}
/* Check if all daemons exist in specified directory. */
static bool has_all_daemons(const char* daemon_dir)
/* Check if all subdaemons exist in specified directory. */
static bool has_all_subdaemons(const char* daemon_dir)
{
size_t i;
bool missing_daemon = false;
for (i = 0; i < ARRAY_SIZE(daemons); ++i) {
if (!path_is_file(path_join(tmpctx, daemon_dir, daemons[i]))) {
for (i = 0; i < ARRAY_SIZE(subdaemons); ++i) {
if (!path_is_file(path_join(tmpctx, daemon_dir, subdaemons[i]))) {
missing_daemon = true;
break;
}
@ -189,7 +190,7 @@ static const char *find_my_pkglibexec_path(const tal_t *ctx,
static const char *find_daemon_dir(const tal_t *ctx, const char *argv0)
{
const char *my_path = find_my_path(ctx, argv0);
if (has_all_daemons(my_path))
if (has_all_subdaemons(my_path))
return my_path;
return find_my_pkglibexec_path(ctx, take(my_path));
}
@ -333,7 +334,7 @@ int main(int argc, char *argv[])
signal(SIGPIPE, SIG_IGN);
/* Make sure we can reach other daemons, and versions match. */
test_daemons(ld);
test_subdaemons(ld);
/* Initialize wallet, now that we are in the correct directory */
ld->wallet = wallet_new(ld, ld->log, &ld->timers);

View File

@ -207,7 +207,7 @@ struct lightningd {
const struct chainparams *get_chainparams(const struct lightningd *ld);
/* Check we can run subdaemons, and check their versions */
void test_daemons(const struct lightningd *ld);
void test_subdaemons(const struct lightningd *ld);
/* Notify lightningd about new blocks. */
void notify_new_block(struct lightningd *ld, u32 block_height);

View File

@ -678,9 +678,9 @@ static void opt_parse_from_config(struct lightningd *ld)
tal_free(contents);
}
static char *test_daemons_and_exit(struct lightningd *ld)
static char *test_subdaemons_and_exit(struct lightningd *ld)
{
test_daemons(ld);
test_subdaemons(ld);
exit(0);
return NULL;
}
@ -705,7 +705,7 @@ void register_opts(struct lightningd *ld)
opt_register_early_noarg("--help|-h", opt_lightningd_usage, ld,
"Print this message.");
opt_register_early_noarg("--test-daemons-only",
test_daemons_and_exit,
test_subdaemons_and_exit,
ld, opt_hidden);
opt_register_arg("--bitcoin-datadir", opt_set_talstr, NULL,
@ -885,7 +885,7 @@ static void add_config(struct lightningd *ld,
|| opt->cb == (void *)opt_set_testnet
|| opt->cb == (void *)opt_set_mainnet
|| opt->cb == (void *)opt_lightningd_usage
|| opt->cb == (void *)test_daemons_and_exit) {
|| opt->cb == (void *)test_subdaemons_and_exit) {
/* These are not important */
} else if (opt->cb == (void *)opt_set_bool) {
const bool *b = opt->u.carg;