mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
connectd: add counters to each peer connection.
This allows us to detect when lightningd hasn't seen our latest disconnect/reconnect; in particular, we would hit the following pattern: 1. lightningd says to connect a subd. 2. connectd disconnects and reconnects. 3. connectd reads message, connects subd. 4. lightningd reads disconnect and reconnect, sends msg to connect to subd again. 5. connectd asserts because subd is alreacy connected. This way connectd can tell if lightningd is talking about the previous connection, and ignoere it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
41b379ed89
commit
d31420211a
@@ -662,7 +662,8 @@ void maybe_disconnect_peer(struct lightningd *ld, struct peer *peer)
|
||||
* tell it to discard again: it might have reconnected! */
|
||||
if (peer->connected == PEER_CONNECTED)
|
||||
subd_send_msg(ld->connectd,
|
||||
take(towire_connectd_discard_peer(NULL, &peer->id)));
|
||||
take(towire_connectd_discard_peer(NULL, &peer->id,
|
||||
peer->connectd_counter)));
|
||||
}
|
||||
|
||||
static struct command_result *json_sendcustommsg(struct command *cmd,
|
||||
|
||||
Reference in New Issue
Block a user