gossip: only send out gossip to non-local peers when we're supposed to.

This hook is called when the queue is empty; we should only send gossip
according to the gossip timer.  We're currently dribbling it out after
every message, in violation of the spec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-02-28 06:53:13 +10:30 committed by Christian Decker
parent c8390ca403
commit be5d945e97

View File

@ -901,10 +901,16 @@ static struct io_plan *nonlocal_dump_gossip(struct io_conn *conn, struct daemon_
/* Make sure we are not connected directly */
assert(!peer->local);
/* Nothing to do if we're not gossiping */
if (!peer->gossip_sync)
return msg_queue_wait(conn, &peer->remote->out,
daemon_conn_write_next, dc);
next = next_broadcast_message(peer->daemon->rstate->broadcasts,
peer->broadcast_index);
if (!next) {
peer->gossip_sync = false;
return msg_queue_wait(conn, &peer->remote->out,
daemon_conn_write_next, dc);
} else {