mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +01:00
connectd: keep array of our listening sockets.
This allows us to free them if we want to stop listening. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
28b31c19dd
commit
05ac74fc44
2 changed files with 11 additions and 5 deletions
|
@ -1568,11 +1568,13 @@ static void connect_activate(struct daemon *daemon, const u8 *msg)
|
|||
strerror(errno));
|
||||
break;
|
||||
}
|
||||
notleak(io_new_listener(daemon,
|
||||
daemon->listen_fds[i]->fd,
|
||||
get_in_cb(daemon->listen_fds[i]
|
||||
->is_websocket),
|
||||
daemon));
|
||||
/* Add to listeners array */
|
||||
tal_arr_expand(&daemon->listeners,
|
||||
io_new_listener(daemon->listeners,
|
||||
daemon->listen_fds[i]->fd,
|
||||
get_in_cb(daemon->listen_fds[i]
|
||||
->is_websocket),
|
||||
daemon));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2025,6 +2027,7 @@ int main(int argc, char *argv[])
|
|||
daemon = tal(NULL, struct daemon);
|
||||
daemon->connection_counter = 1;
|
||||
daemon->peers = tal(daemon, struct peer_htable);
|
||||
daemon->listeners = tal_arr(daemon, struct io_listener *, 0);
|
||||
peer_htable_init(daemon->peers);
|
||||
memleak_add_helper(daemon, memleak_daemon_cb);
|
||||
list_head_init(&daemon->connecting);
|
||||
|
|
|
@ -145,6 +145,9 @@ struct daemon {
|
|||
/* Connection to gossip daemon. */
|
||||
struct daemon_conn *gossipd;
|
||||
|
||||
/* Any listening sockets we have. */
|
||||
struct io_listener **listeners;
|
||||
|
||||
/* Allow localhost to be considered "public": DEVELOPER-only option,
|
||||
* but for simplicity we don't #if DEVELOPER-wrap it here. */
|
||||
bool dev_allow_localhost;
|
||||
|
|
Loading…
Add table
Reference in a new issue