|
|
@ -690,13 +690,6 @@ static void wake_pkt_out(struct peer *peer) |
|
|
|
/* Mutual recursion. */ |
|
|
|
static struct io_plan *peer_pkt_out(struct io_conn *conn, struct peer *peer); |
|
|
|
|
|
|
|
static struct io_plan *local_gossip_broadcast_done(struct io_conn *conn, |
|
|
|
struct peer *peer) |
|
|
|
{ |
|
|
|
peer->broadcast_index++; |
|
|
|
return peer_pkt_out(conn, peer); |
|
|
|
} |
|
|
|
|
|
|
|
static struct io_plan *peer_pkt_out(struct io_conn *conn, struct peer *peer) |
|
|
|
{ |
|
|
|
/* First priority is queued packets, if any */ |
|
|
@ -719,12 +712,12 @@ static struct io_plan *peer_pkt_out(struct io_conn *conn, struct peer *peer) |
|
|
|
struct queued_message *next; |
|
|
|
|
|
|
|
next = next_broadcast_message(peer->daemon->rstate->broadcasts, |
|
|
|
peer->broadcast_index); |
|
|
|
&peer->broadcast_index); |
|
|
|
|
|
|
|
if (next) |
|
|
|
return peer_write_message(conn, &peer->local->pcs, |
|
|
|
next->payload, |
|
|
|
local_gossip_broadcast_done); |
|
|
|
peer_pkt_out); |
|
|
|
|
|
|
|
/* Gossip is drained. Wait for next timer. */ |
|
|
|
peer->gossip_sync = false; |
|
|
@ -916,15 +909,6 @@ static bool send_peer_with_fds(struct peer *peer, const u8 *msg) |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
static struct io_plan *nonlocal_gossip_broadcast_done(struct io_conn *conn, |
|
|
|
struct daemon_conn *dc) |
|
|
|
{ |
|
|
|
struct peer *peer = dc->ctx; |
|
|
|
|
|
|
|
peer->broadcast_index++; |
|
|
|
return nonlocal_dump_gossip(conn, dc); |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
* nonlocal_dump_gossip - catch the nonlocal peer up with the latest gossip. |
|
|
|
* |
|
|
@ -945,7 +929,7 @@ static struct io_plan *nonlocal_dump_gossip(struct io_conn *conn, struct daemon_ |
|
|
|
daemon_conn_write_next, dc); |
|
|
|
|
|
|
|
next = next_broadcast_message(peer->daemon->rstate->broadcasts, |
|
|
|
peer->broadcast_index); |
|
|
|
&peer->broadcast_index); |
|
|
|
|
|
|
|
if (!next) { |
|
|
|
peer->gossip_sync = false; |
|
|
@ -956,7 +940,7 @@ static struct io_plan *nonlocal_dump_gossip(struct io_conn *conn, struct daemon_ |
|
|
|
peer->broadcast_index, |
|
|
|
next->payload); |
|
|
|
return io_write_wire(conn, take(msg), |
|
|
|
nonlocal_gossip_broadcast_done, dc); |
|
|
|
nonlocal_dump_gossip, dc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|