mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-09 17:14:28 +01:00
connectd: don't leak fds if we have both IPv4 and IPv6.
We accept that we will fail to listen if we bind both IPv6 and IPv4 to the same socket on a dual-stack machine (e.g. normal Linux), but we weren't closing the fd. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1561,8 +1561,10 @@ static void connect_activate(struct daemon *daemon, const u8 *msg)
|
||||
if (do_listen) {
|
||||
for (size_t i = 0; i < tal_count(daemon->listen_fds); i++) {
|
||||
if (listen(daemon->listen_fds[i]->fd, 64) != 0) {
|
||||
if (daemon->listen_fds[i]->mayfail)
|
||||
if (daemon->listen_fds[i]->mayfail) {
|
||||
close(daemon->listen_fds[i]->fd);
|
||||
continue;
|
||||
}
|
||||
errmsg = tal_fmt(tmpctx,
|
||||
"Failed to listen on socket %s: %s",
|
||||
type_to_string(tmpctx,
|
||||
|
||||
Reference in New Issue
Block a user