connectd: restore gossip filter aging.

When we moved gossip filtering to connectd, this aging got lost.

Without this, we hit the 10,000 entry limit before expiring full
gossip anti-echo cache.  This is under 1M in allocations per peer, but
in DEVELOPER mode each allocation includes adds 3 notifiers (32 bytes
each) and a backtrace child (40 + 40 + 256 bytes), making it almost
10MB per peer, plus allocation overhead.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: connectd: large memory usage with many peers fixed.
This commit is contained in:
Rusty Russell 2022-06-16 17:02:28 +09:30
parent 572942c783
commit ecdfbbf359

View File

@ -344,6 +344,9 @@ static struct io_plan *encrypt_and_send(struct peer *peer,
/* Kicks off write_to_peer() to look for more gossip to send from store */
static void wake_gossip(struct peer *peer)
{
/* Don't remember sent per-peer gossip forever. */
gossip_rcvd_filter_age(peer->gs.grf);
peer->gs.active = IFDEV(!peer->daemon->dev_suppress_gossip, true);
io_wake(peer->peer_outq);