Skip to content

Commit 6a05f24

Browse files
committed
connectd: fix diagnostics if we get a long delay.
In a0fd72e 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 <[email protected]>
1 parent cbc38c7 commit 6a05f24

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

connectd/multiplex.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ static struct io_plan *write_to_peer(struct io_conn *peer_conn,
10931093
if (!msg) {
10941094
/* Tell them to read again, */
10951095
io_wake(&peer->subds);
1096+
io_wake(&peer->peer_in);
10961097

10971098
/* Wait for them to wake us */
10981099
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,
12661267
return next_read(peer_conn, peer);
12671268

12681269
/* If we swallow this, just try again. */
1269-
if (handle_message_locally(peer, decrypted))
1270-
return next_read(peer_conn, peer);
1270+
if (handle_message_locally(peer, decrypted)) {
1271+
/* Make sure to update peer->peer_in_lastmsg so we blame correct msg! */
1272+
io_wake(peer->peer_outq);
1273+
goto out;
1274+
}
12711275

12721276
/* After this we should be able to match to subd by channel_id */
12731277
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,
13341338

13351339
/* Wait for them to wake us */
13361340
peer->peer_in_lastmsg = type;
1341+
out:
13371342
peer->peer_in_lasttime = time_mono();
13381343

13391344
return io_wait(peer_conn, &peer->peer_in, next_read, peer);

0 commit comments

Comments
 (0)