mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +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:
committed by
Vincenzo Palazzo
parent
28b31c19dd
commit
05ac74fc44
@@ -1568,7 +1568,9 @@ static void connect_activate(struct daemon *daemon, const u8 *msg)
|
|||||||
strerror(errno));
|
strerror(errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
notleak(io_new_listener(daemon,
|
/* Add to listeners array */
|
||||||
|
tal_arr_expand(&daemon->listeners,
|
||||||
|
io_new_listener(daemon->listeners,
|
||||||
daemon->listen_fds[i]->fd,
|
daemon->listen_fds[i]->fd,
|
||||||
get_in_cb(daemon->listen_fds[i]
|
get_in_cb(daemon->listen_fds[i]
|
||||||
->is_websocket),
|
->is_websocket),
|
||||||
@@ -2025,6 +2027,7 @@ int main(int argc, char *argv[])
|
|||||||
daemon = tal(NULL, struct daemon);
|
daemon = tal(NULL, struct daemon);
|
||||||
daemon->connection_counter = 1;
|
daemon->connection_counter = 1;
|
||||||
daemon->peers = tal(daemon, struct peer_htable);
|
daemon->peers = tal(daemon, struct peer_htable);
|
||||||
|
daemon->listeners = tal_arr(daemon, struct io_listener *, 0);
|
||||||
peer_htable_init(daemon->peers);
|
peer_htable_init(daemon->peers);
|
||||||
memleak_add_helper(daemon, memleak_daemon_cb);
|
memleak_add_helper(daemon, memleak_daemon_cb);
|
||||||
list_head_init(&daemon->connecting);
|
list_head_init(&daemon->connecting);
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ struct daemon {
|
|||||||
/* Connection to gossip daemon. */
|
/* Connection to gossip daemon. */
|
||||||
struct daemon_conn *gossipd;
|
struct daemon_conn *gossipd;
|
||||||
|
|
||||||
|
/* Any listening sockets we have. */
|
||||||
|
struct io_listener **listeners;
|
||||||
|
|
||||||
/* Allow localhost to be considered "public": DEVELOPER-only option,
|
/* Allow localhost to be considered "public": DEVELOPER-only option,
|
||||||
* but for simplicity we don't #if DEVELOPER-wrap it here. */
|
* but for simplicity we don't #if DEVELOPER-wrap it here. */
|
||||||
bool dev_allow_localhost;
|
bool dev_allow_localhost;
|
||||||
|
|||||||
Reference in New Issue
Block a user