Browse Source

gossipd: rename fail_peer to drop_peer.

We don't actually send it a failure message, we just close it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
399b5f61bc
  1. 16
      gossipd/gossip.c
  2. 4
      gossipd/gossip_wire.csv
  3. 2
      lightningd/gossip_control.c
  4. 2
      lightningd/peer_control.c

16
gossipd/gossip.c

@ -459,25 +459,25 @@ static struct io_plan *release_peer(struct io_conn *conn, struct daemon *daemon,
return daemon_conn_read_next(conn, &daemon->master);
}
static struct io_plan *fail_peer(struct io_conn *conn, struct daemon *daemon,
static struct io_plan *drop_peer(struct io_conn *conn, struct daemon *daemon,
const u8 *msg)
{
u64 unique_id;
struct peer *peer;
if (!fromwire_gossipctl_fail_peer(msg, NULL, &unique_id))
master_badmsg(WIRE_GOSSIPCTL_FAIL_PEER, msg);
if (!fromwire_gossipctl_drop_peer(msg, NULL, &unique_id))
master_badmsg(WIRE_GOSSIPCTL_DROP_PEER, msg);
/* This may not find the peer, if we fail beforehand. */
peer = find_peer(daemon, unique_id);
if (!peer)
status_trace("Unknown fail_peer %"PRIu64, unique_id);
status_trace("Unknown drop_peer %"PRIu64, unique_id);
else if (peer->local) {
status_trace("fail_peer %"PRIu64, unique_id);
status_trace("drop_peer %"PRIu64, unique_id);
/* This owns the peer, so we can free it */
io_close(peer->conn);
} else {
status_trace("Could not fail_peer %"PRIu64", it's not local",
status_trace("Could not drop_peer %"PRIu64", it's not local",
unique_id);
}
@ -719,8 +719,8 @@ static struct io_plan *recv_req(struct io_conn *conn, struct daemon_conn *master
return new_peer(conn, daemon, master->msg_in);
case WIRE_GOSSIPCTL_RELEASE_PEER:
return release_peer(conn, daemon, master->msg_in);
case WIRE_GOSSIPCTL_FAIL_PEER:
return fail_peer(conn, daemon, master->msg_in);
case WIRE_GOSSIPCTL_DROP_PEER:
return drop_peer(conn, daemon, master->msg_in);
case WIRE_GOSSIPCTL_GET_PEER_GOSSIPFD:
return new_peer_fd(conn, daemon, master->msg_in);

4
gossipd/gossip_wire.csv

@ -98,8 +98,8 @@ gossip_forwarded_msg,,msglen,u16
gossip_forwarded_msg,,msg,msglen*u8
# If peer is still connected, fail it (master does this for reconnect)
gossipctl_fail_peer,3011
gossipctl_fail_peer,,unique_id,u64
gossipctl_drop_peer,3011
gossipctl_drop_peer,,unique_id,u64
# Get a gossip fd for this peer (it has reconnected)
gossipctl_get_peer_gossipfd,3012

Can't render this file because it has a wrong number of fields in line 2.

2
lightningd/gossip_control.c

@ -96,7 +96,7 @@ static int gossip_msg(struct subd *gossip, const u8 *msg, const int *fds)
case WIRE_GOSSIPCTL_INIT:
case WIRE_GOSSIPCTL_NEW_PEER:
case WIRE_GOSSIPCTL_RELEASE_PEER:
case WIRE_GOSSIPCTL_FAIL_PEER:
case WIRE_GOSSIPCTL_DROP_PEER:
case WIRE_GOSSIPCTL_GET_PEER_GOSSIPFD:
case WIRE_GOSSIP_GETNODES_REQUEST:
case WIRE_GOSSIP_GETROUTE_REQUEST:

2
lightningd/peer_control.c

@ -498,7 +498,7 @@ static bool peer_reconnected(struct lightningd *ld,
case GOSSIPD:
/* Tell gossipd to kick that one out, will call peer_fail */
subd_send_msg(peer->ld->gossip,
take(towire_gossipctl_fail_peer(peer,
take(towire_gossipctl_drop_peer(peer,
peer->unique_id)));
tal_free(peer);
/* Continue with a new peer. */

Loading…
Cancel
Save