From 399b5f61bcf0134eda51d6140c3b756fc8e1493d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 11 Oct 2017 20:25:50 +1030 Subject: [PATCH] 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 --- gossipd/gossip.c | 16 ++++++++-------- gossipd/gossip_wire.csv | 4 ++-- lightningd/gossip_control.c | 2 +- lightningd/peer_control.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 2af61d2e6..9e4314702 100644 --- a/gossipd/gossip.c +++ b/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); diff --git a/gossipd/gossip_wire.csv b/gossipd/gossip_wire.csv index ff95a30f6..7cd398080 100644 --- a/gossipd/gossip_wire.csv +++ b/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 diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 5c0a13403..f5d6cddcb 100644 --- a/lightningd/gossip_control.c +++ b/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: diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 5086a0220..5d1ea5cee 100644 --- a/lightningd/peer_control.c +++ b/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. */