connectd: log broken if TCP_CORK fails.

But not if we're a developer using dev_disconnect, which substitutes the fd.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-04-09 12:55:09 +09:30
parent 295557ac50
commit ed58c24bc7
3 changed files with 13 additions and 10 deletions

View file

@ -1523,8 +1523,12 @@ static void connect_init(struct daemon *daemon, const u8 *msg)
tal_free(announceable);
#if DEVELOPER
if (dev_disconnect)
if (dev_disconnect) {
daemon->dev_disconnect_fd = 5;
dev_disconnect_init(5);
} else {
daemon->dev_disconnect_fd = -1;
}
#endif
}

View file

@ -201,6 +201,8 @@ struct daemon {
bool dev_no_ping_timer;
/* Hack to no longer send gossip */
bool dev_suppress_gossip;
/* dev_disconnect file */
int dev_disconnect_fd;
#endif
};

View file

@ -315,7 +315,6 @@ static void set_urgent_flag(struct peer *peer, bool urgent)
int val;
int opt;
const char *optname;
static bool complained = false;
if (urgent == peer->urgent)
return;
@ -337,14 +336,12 @@ static void set_urgent_flag(struct peer *peer, bool urgent)
val = urgent;
if (setsockopt(io_conn_fd(peer->to_peer),
IPPROTO_TCP, opt, &val, sizeof(val)) != 0) {
/* This actually happens in testing, where we blackhole the fd */
if (!complained) {
status_unusual("setsockopt %s=1: %s",
optname,
strerror(errno));
complained = true;
}
IPPROTO_TCP, opt, &val, sizeof(val)) != 0
/* This actually happens in testing, where we blackhole the fd */
&& IFDEV(peer->daemon->dev_disconnect_fd == -1, true)) {
status_broken("setsockopt %s=1 fd=%u: %s",
optname, io_conn_fd(peer->to_peer),
strerror(errno));
}
peer->urgent = urgent;
}