connectd: log if we fail an accept() call.

This can happen if we're totally out of fds, but previously we gave
no log message indicating this!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-05-09 12:51:11 +09:30
parent c1ee8e4981
commit c8c87e2bf6

View File

@ -465,6 +465,17 @@ static struct io_plan *connection_in(struct io_conn *conn,
{
struct conn_in conn_in_arg;
/* Did we fail to accept? */
if (!conn) {
static bool accept_logged = false;
if (!accept_logged) {
status_broken("accepting incoming fd failed: %s",
strerror(errno));
accept_logged = true;
}
return NULL;
}
conn_in_arg.addr.u.wireaddr.is_websocket = false;
if (!get_remote_address(conn, &conn_in_arg.addr))
return io_close(conn);
@ -2184,6 +2195,9 @@ int main(int argc, char *argv[])
* status_failed on error. */
ecdh_hsmd_setup(HSM_FD, status_failed);
/* We want to know about accept() and recvmsg failures */
io_set_extended_errors(true);
for (;;) {
struct timer *expired;
io_loop(&daemon->timers, &expired);