From 94cb42bee649cd50fa0d0f3ec6972dff06d87ce0 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Thu, 2 Dec 2021 17:16:42 +0100 Subject: [PATCH] status: do not log ping and pong packets Debug logging of ping and pong packets turned out to be too excessive since this is now done on all channels and without config option. Changelog-None --- common/status.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/common/status.c b/common/status.c index 61fbdc3ef..499484c39 100644 --- a/common/status.c +++ b/common/status.c @@ -98,13 +98,25 @@ static void status_io_full(enum log_level iodir, status_send(take(towire_status_io(NULL, iodir, peer, who, p))); } +static bool status_peer_io_filter_packettype(const u8 *p) +{ + int msg_type = fromwire_peektype(p); + switch (msg_type) { + case WIRE_PING: + case WIRE_PONG: + return true; + } + return false; +} + static void status_peer_io_short(enum log_level iodir, const struct node_id *peer, const u8 *p) { - status_peer_debug(peer, "%s %s", - iodir == LOG_IO_OUT ? "peer_out" : "peer_in", - peer_wire_name(fromwire_peektype(p))); + if (!status_peer_io_filter_packettype(p)) + status_peer_debug(peer, "%s %s", + iodir == LOG_IO_OUT ? "peer_out" : "peer_in", + peer_wire_name(fromwire_peektype(p))); } void status_peer_io(enum log_level iodir,