lightningd/peer_control: keep cryptostate.

Like the fd, it's only useful when the peer is not in a daemon, so we
free & NULL it when that happens.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-05-23 20:33:17 +09:30
parent ccad93edb3
commit 1e36a19164
3 changed files with 29 additions and 17 deletions

View File

@@ -87,12 +87,15 @@ static void peer_nongossip(struct subd *gossip, const u8 *msg,
/* It returned the fd. */
assert(peer->fd == -1);
peer->fd = peer_fd;
assert(peer->cs == NULL);
peer->cs = tal_dup(peer, struct crypto_state, &cs);
peer->gossip_client_fd = gossip_fd;
log_info(peer->log, "Gossip ended up receipt of %s",
wire_type_name(fromwire_peektype(inner)));
peer_accept_open(peer, &cs, inner);
peer_accept_open(peer, inner);
}
static int gossip_msg(struct subd *gossip, const u8 *msg, const int *fds)