subd: remove context arg, as we're always owned by lightningd.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-09-28 13:13:19 +09:30 committed by Christian Decker
parent 8741043a0e
commit b7bb0be944
5 changed files with 11 additions and 14 deletions

View File

@ -136,7 +136,7 @@ void gossip_init(struct lightningd *ld)
{
tal_t *tmpctx = tal_tmpctx(ld);
u8 *init;
ld->gossip = new_subd(ld, ld, "lightning_gossipd", NULL,
ld->gossip = new_subd(ld, "lightning_gossipd", NULL,
gossip_wire_type_name,
gossip_msg, NULL, gossip_finished, NULL);
if (!ld->gossip)

View File

@ -220,7 +220,7 @@ static struct io_plan *hsm_then_handshake(struct io_conn *conn,
io_fd_block(connfd, true);
/* Give handshake daemon the hsm fd. */
handshaked = new_subd(ld, ld,
handshaked = new_subd(ld,
"lightning_handshaked", NULL,
handshake_wire_type_name,
NULL, NULL, NULL,

View File

@ -1396,7 +1396,7 @@ static enum watch_result funding_spent(struct peer *peer,
/* We could come from almost any state. */
peer_set_condition(peer, peer->state, FUNDING_SPEND_SEEN);
peer->owner = new_subd(peer->ld, peer->ld,
peer->owner = new_subd(peer->ld,
"lightning_onchaind", peer,
onchain_wire_type_name,
onchain_msg,
@ -1950,7 +1950,7 @@ static void peer_start_closingd(struct peer *peer,
return;
}
peer->owner = new_subd(peer->ld, peer->ld,
peer->owner = new_subd(peer->ld,
"lightning_closingd", peer,
closing_wire_type_name,
closing_msg,
@ -2126,7 +2126,7 @@ static bool peer_start_channeld(struct peer *peer,
if (hsmfd < 0)
fatal("Could not read fd from HSM: %s", strerror(errno));
peer->owner = new_subd(peer->ld, peer->ld,
peer->owner = new_subd(peer->ld,
"lightning_channeld", peer,
channel_wire_type_name,
channel_msg,
@ -2478,7 +2478,7 @@ void peer_fundee_open(struct peer *peer, const u8 *from_peer,
}
peer_set_condition(peer, GOSSIPD, OPENINGD);
peer->owner = new_subd(ld, ld, "lightning_openingd", peer,
peer->owner = new_subd(ld, "lightning_openingd", peer,
opening_wire_type_name,
NULL, bad_peer, peer_owner_finished,
take(&peer_fd), take(&gossip_fd),
@ -2561,7 +2561,7 @@ static bool gossip_peer_released(struct subd *gossip,
assert(tal_count(fds) == 2);
peer_set_condition(fc->peer, GOSSIPD, OPENINGD);
opening = new_subd(fc->peer->ld, ld,
opening = new_subd(ld,
"lightning_openingd", fc->peer,
opening_wire_type_name,
NULL, bad_peer, peer_owner_finished,

View File

@ -504,8 +504,7 @@ static struct io_plan *msg_setup(struct io_conn *conn, struct subd *sd)
msg_send_next(conn, sd));
}
struct subd *new_subd(const tal_t *ctx,
struct lightningd *ld,
struct subd *new_subd(struct lightningd *ld,
const char *name,
struct peer *peer,
const char *(*msgname)(int msgtype),
@ -515,7 +514,7 @@ struct subd *new_subd(const tal_t *ctx,
...)
{
va_list ap;
struct subd *sd = tal(ctx, struct subd);
struct subd *sd = tal(ld, struct subd);
int msg_fd;
va_start(ap, finished);
@ -541,7 +540,7 @@ struct subd *new_subd(const tal_t *ctx,
sd->peer = peer;
/* conn actually owns daemon: we die when it does. */
sd->conn = io_new_conn(ctx, msg_fd, msg_setup, sd);
sd->conn = io_new_conn(ld, msg_fd, msg_setup, sd);
tal_steal(sd->conn, sd);
log_info(sd->log, "pid %u, msgfd %i", sd->pid, msg_fd);

View File

@ -55,7 +55,6 @@ struct subd {
/**
* new_subd - create a new subdaemon.
* @ctx: context to allocate from
* @ld: global state
* @name: basename of daemon
* @peer: peer to associate (if any).
@ -70,8 +69,7 @@ struct subd {
* that many @fds are received before calling again. If it returns -1, the
* subdaemon is shutdown.
*/
struct subd *new_subd(const tal_t *ctx,
struct lightningd *ld,
struct subd *new_subd(struct lightningd *ld,
const char *name,
struct peer *peer,
const char *(*msgname)(int msgtype),