lightningd tells us a peer should be disconnected. */
| 1974 | |
| 1975 | /* lightningd tells us a peer should be disconnected. */ |
| 1976 | static void peer_disconnect(struct daemon *daemon, const u8 *msg) |
| 1977 | { |
| 1978 | struct node_id id; |
| 1979 | u64 counter; |
| 1980 | struct peer *peer; |
| 1981 | |
| 1982 | if (!fromwire_connectd_disconnect_peer(msg, &id, &counter)) |
| 1983 | master_badmsg(WIRE_CONNECTD_DISCONNECT_PEER, msg); |
| 1984 | |
| 1985 | /* We should stay in sync with lightningd, but this can happen |
| 1986 | * under stress. */ |
| 1987 | peer = peer_htable_get(daemon->peers, &id); |
| 1988 | if (!peer) |
| 1989 | return; |
| 1990 | |
| 1991 | /* If it's reconnected already, it will learn soon. */ |
| 1992 | if (peer->counter != counter) |
| 1993 | return; |
| 1994 | |
| 1995 | disconnect_peer(peer); |
| 1996 | } |
| 1997 | |
| 1998 | /* lightningd tells us a peer is no longer "important". */ |
| 1999 | static void peer_downgrade(struct daemon *daemon, const u8 *msg) |
no test coverage detected