gossipd: Revert 6afc7dcc09.

This bandaid was solved properly by 94711969f9
where other daemons say where they were up to.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-03-14 02:13:55 +10:30
parent afe61cb841
commit 87effd90c2
3 changed files with 9 additions and 23 deletions

View File

@ -49,9 +49,10 @@ bool replace_broadcast(const tal_t *ctx,
return evicted; return evicted;
} }
struct queued_message *next_broadcast_message(struct broadcast_state *bstate, u64 last_index) struct queued_message *next_broadcast_message(struct broadcast_state *bstate,
u64 *last_index)
{ {
return uintmap_after(&bstate->broadcasts, &last_index); return uintmap_after(&bstate->broadcasts, last_index);
} }
const u8 *get_broadcast(struct broadcast_state *bstate, u64 msgidx) const u8 *get_broadcast(struct broadcast_state *bstate, u64 msgidx)

View File

@ -34,7 +34,8 @@ bool replace_broadcast(const tal_t *ctx,
const u8 *payload TAKES); const u8 *payload TAKES);
struct queued_message *next_broadcast_message(struct broadcast_state *bstate, u64 last_index); struct queued_message *next_broadcast_message(struct broadcast_state *bstate,
u64 *last_index);
const u8 *get_broadcast(struct broadcast_state *bstate, u64 msgidx); const u8 *get_broadcast(struct broadcast_state *bstate, u64 msgidx);
#endif /* LIGHTNING_LIGHTNINGD_GOSSIP_BROADCAST_H */ #endif /* LIGHTNING_LIGHTNINGD_GOSSIP_BROADCAST_H */

View File

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