options: use NULL for unset Tor settings.

Rename tor_proxyaddrs and tor_serviceaddrs to tor_proxyaddr and tor_serviceaddr:
the 's' at the end suggests that there can be more than one.

Make them NULL or non-NULL, rather than using all-zero if unset.

Hand them the same way to gossipd; it's a bit of a hack since we don't
have optional fields, so we use a counter which is always 0 or 1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-05-10 08:48:23 +09:30
parent ef09961713
commit 11db7ca9e6
8 changed files with 36 additions and 32 deletions

View File

@@ -173,8 +173,8 @@ void tor_init(struct lightningd *ld)
return;
/* FIXME: Need better way to convert wireaddr to addrinfo... */
if (getaddrinfo(fmt_wireaddr_without_port(ld, ld->tor_serviceaddrs),
tal_fmt(tmpctx, "%d", ld->tor_serviceaddrs->port), NULL,
if (getaddrinfo(fmt_wireaddr_without_port(ld, ld->tor_serviceaddr),
tal_fmt(tmpctx, "%d", ld->tor_serviceaddr->port), NULL,
&ai_tor) != 0)
errx(1, "getaddrinfo failed for Tor service");