connectd: fix diagnostics if we get a long delay.

In a0fd72eb5e I added a diagnostic message if messages cause large
delays, *but* I didn't set the "peer_in_lasttime" variable in the case
of locally-handled packets.

I really want this in the release: the point of this was to try to
diagnose some high-latency ping issues we've seen on the real network.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-09-02 14:13:57 +09:30
parent cbc38c789f
commit 6a05f240d3

View File

@@ -1093,6 +1093,7 @@ static struct io_plan *write_to_peer(struct io_conn *peer_conn,
if (!msg) { if (!msg) {
/* Tell them to read again, */ /* Tell them to read again, */
io_wake(&peer->subds); io_wake(&peer->subds);
io_wake(&peer->peer_in);
/* Wait for them to wake us */ /* Wait for them to wake us */
return msg_queue_wait(peer_conn, peer->peer_outq, return msg_queue_wait(peer_conn, peer->peer_outq,
@@ -1266,8 +1267,11 @@ static struct io_plan *read_body_from_peer_done(struct io_conn *peer_conn,
return next_read(peer_conn, peer); return next_read(peer_conn, peer);
/* If we swallow this, just try again. */ /* If we swallow this, just try again. */
if (handle_message_locally(peer, decrypted)) if (handle_message_locally(peer, decrypted)) {
return next_read(peer_conn, peer); /* Make sure to update peer->peer_in_lastmsg so we blame correct msg! */
io_wake(peer->peer_outq);
goto out;
}
/* After this we should be able to match to subd by channel_id */ /* After this we should be able to match to subd by channel_id */
if (!extract_channel_id(decrypted, &channel_id)) { if (!extract_channel_id(decrypted, &channel_id)) {
@@ -1334,6 +1338,7 @@ static struct io_plan *read_body_from_peer_done(struct io_conn *peer_conn,
/* Wait for them to wake us */ /* Wait for them to wake us */
peer->peer_in_lastmsg = type; peer->peer_in_lastmsg = type;
out:
peer->peer_in_lasttime = time_mono(); peer->peer_in_lasttime = time_mono();
return io_wait(peer_conn, &peer->peer_in, next_read, peer); return io_wait(peer_conn, &peer->peer_in, next_read, peer);