mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
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:
@@ -1523,8 +1523,12 @@ static void connect_init(struct daemon *daemon, const u8 *msg)
|
|||||||
tal_free(announceable);
|
tal_free(announceable);
|
||||||
|
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
if (dev_disconnect)
|
if (dev_disconnect) {
|
||||||
|
daemon->dev_disconnect_fd = 5;
|
||||||
dev_disconnect_init(5);
|
dev_disconnect_init(5);
|
||||||
|
} else {
|
||||||
|
daemon->dev_disconnect_fd = -1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -201,6 +201,8 @@ struct daemon {
|
|||||||
bool dev_no_ping_timer;
|
bool dev_no_ping_timer;
|
||||||
/* Hack to no longer send gossip */
|
/* Hack to no longer send gossip */
|
||||||
bool dev_suppress_gossip;
|
bool dev_suppress_gossip;
|
||||||
|
/* dev_disconnect file */
|
||||||
|
int dev_disconnect_fd;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -315,7 +315,6 @@ static void set_urgent_flag(struct peer *peer, bool urgent)
|
|||||||
int val;
|
int val;
|
||||||
int opt;
|
int opt;
|
||||||
const char *optname;
|
const char *optname;
|
||||||
static bool complained = false;
|
|
||||||
|
|
||||||
if (urgent == peer->urgent)
|
if (urgent == peer->urgent)
|
||||||
return;
|
return;
|
||||||
@@ -337,14 +336,12 @@ static void set_urgent_flag(struct peer *peer, bool urgent)
|
|||||||
|
|
||||||
val = urgent;
|
val = urgent;
|
||||||
if (setsockopt(io_conn_fd(peer->to_peer),
|
if (setsockopt(io_conn_fd(peer->to_peer),
|
||||||
IPPROTO_TCP, opt, &val, sizeof(val)) != 0) {
|
IPPROTO_TCP, opt, &val, sizeof(val)) != 0
|
||||||
/* This actually happens in testing, where we blackhole the fd */
|
/* This actually happens in testing, where we blackhole the fd */
|
||||||
if (!complained) {
|
&& IFDEV(peer->daemon->dev_disconnect_fd == -1, true)) {
|
||||||
status_unusual("setsockopt %s=1: %s",
|
status_broken("setsockopt %s=1 fd=%u: %s",
|
||||||
optname,
|
optname, io_conn_fd(peer->to_peer),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
complained = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
peer->urgent = urgent;
|
peer->urgent = urgent;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user