mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
connectd: temporarily have two fds to gossipd.
We want to stream gossip through this, but currently connectd treats the fd as synchronous. While we work on getting rid of that, it's easiest to have two fds. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -403,9 +403,9 @@ static void connect_init_done(struct subd *connectd,
|
||||
io_break(connectd);
|
||||
}
|
||||
|
||||
int connectd_init(struct lightningd *ld)
|
||||
int connectd_init(struct lightningd *ld, int *gossipd_fd2)
|
||||
{
|
||||
int fds[2];
|
||||
int fds[2], fds2[2];
|
||||
u8 *msg;
|
||||
int hsmfd;
|
||||
struct wireaddr_internal *wireaddrs = ld->proposed_wireaddr;
|
||||
@@ -418,11 +418,16 @@ int connectd_init(struct lightningd *ld)
|
||||
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) != 0)
|
||||
fatal("Could not socketpair for connectd<->gossipd");
|
||||
|
||||
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds2) != 0)
|
||||
fatal("Could not socketpair for connectd<->gossipd 2");
|
||||
|
||||
hsmfd = hsm_get_global_fd(ld, HSM_CAP_ECDH);
|
||||
|
||||
ld->connectd = new_global_subd(ld, "lightning_connectd",
|
||||
connectd_wire_name, connectd_msg,
|
||||
take(&hsmfd), take(&fds[1]),
|
||||
take(&hsmfd),
|
||||
take(&fds[1]),
|
||||
take(&fds2[1]),
|
||||
#if DEVELOPER
|
||||
/* Not take(): we share it */
|
||||
ld->dev_disconnect_fd >= 0 ?
|
||||
@@ -463,6 +468,7 @@ int connectd_init(struct lightningd *ld)
|
||||
/* Wait for init_reply */
|
||||
io_loop(NULL, NULL);
|
||||
|
||||
*gossipd_fd2 = fds2[0];
|
||||
return fds[0];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user