Browse Source

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>
ppa-0.6.1
Rusty Russell 7 years ago
parent
commit
87effd90c2
  1. 5
      gossipd/broadcast.c
  2. 3
      gossipd/broadcast.h
  3. 24
      gossipd/gossip.c

5
gossipd/broadcast.c

@ -49,9 +49,10 @@ bool replace_broadcast(const tal_t *ctx,
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)

3
gossipd/broadcast.h

@ -34,7 +34,8 @@ bool replace_broadcast(const tal_t *ctx,
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);
#endif /* LIGHTNING_LIGHTNINGD_GOSSIP_BROADCAST_H */

24
gossipd/gossip.c

@ -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);
}
}

Loading…
Cancel
Save