connectd: fix debug message on bind fail.

It doesn't get the right errno, and it says "create" not "bind".

```
2022-05-20T03:04:46.498Z DEBUG   connectd: Failed to create 2 socket: Success
2022-05-20T03:04:46.500Z DEBUG   connectd: REPLY WIRE_CONNECTD_INIT_REPLY with 0 fds
2022-05-20T03:04:46.501Z DEBUG   connectd: connectd_init_done
2022-05-20T03:04:46.503Z **BROKEN** connectd: Failed to bind socket for 127.0.0.1:37871: Address already in use
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-06-26 14:01:01 +09:30
parent 71b1eaf2fe
commit a1b8b40d13

View File

@ -1077,14 +1077,14 @@ static struct listen_fd *make_listen_fd(const tal_t *ctx,
int on = 1; int on = 1;
if (fd < 0) { if (fd < 0) {
const char *es = strerror(errno);
*errstr = tal_fmt(ctx, "Failed to create socket for %s%s: %s", *errstr = tal_fmt(ctx, "Failed to create socket for %s%s: %s",
is_websocket ? "websocket " : "", is_websocket ? "websocket " : "",
type_to_string(tmpctx, type_to_string(tmpctx,
struct wireaddr_internal, struct wireaddr_internal,
wi), wi),
strerror(errno)); es);
status_debug("Failed to create %u socket: %s", status_debug("Failed to create %u socket: %s", domain, es);
domain, strerror(errno));
return NULL; return NULL;
} }
@ -1094,14 +1094,14 @@ static struct listen_fd *make_listen_fd(const tal_t *ctx,
strerror(errno)); strerror(errno));
if (bind(fd, addr, len) != 0) { if (bind(fd, addr, len) != 0) {
const char *es = strerror(errno);
*errstr = tal_fmt(ctx, "Failed to bind socket for %s%s: %s", *errstr = tal_fmt(ctx, "Failed to bind socket for %s%s: %s",
is_websocket ? "websocket " : "", is_websocket ? "websocket " : "",
type_to_string(tmpctx, type_to_string(tmpctx,
struct wireaddr_internal, struct wireaddr_internal,
wi), wi),
strerror(errno)); es);
status_debug("Failed to create %u socket: %s", status_debug("Failed to bind %u socket: %s", domain, es);
domain, strerror(errno));
goto fail; goto fail;
} }