connectd: fix fd leak for --offline.

```
**BROKEN** connectd: dev_report_fds: 5 open but unowned?
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-10-24 12:58:45 +10:30
parent 35a47c57e3
commit 25110ff2cc
2 changed files with 9 additions and 0 deletions

View File

@ -1543,6 +1543,9 @@ static void connect_activate(struct daemon *daemon, const u8 *msg)
->is_websocket),
daemon));
}
} else {
for (size_t i = 0; i < tal_count(daemon->listen_fds); i++)
close(daemon->listen_fds[i]->fd);
}
/* Free, with NULL assignment just as an extra sanity check. */

View File

@ -4409,3 +4409,9 @@ def test_reconnect_no_additional_transient_failure(node_factory, bitcoind):
# We should not see a "Peer transient failure" after restart of l1
assert not l1.daemon.is_in_log(f"{l2id}-chan#1: Peer transient failure in CHANNELD_NORMAL: Disconnected", start=offset1)
def test_offline_fd_check(node_factory):
# if get_node starts it, it'll expect an address, so do it manually.
l1 = node_factory.get_node(options={"offline": None}, start=False)
l1.daemon.start()