Skip to content

Commit ca0c723

Browse files
committed
Dont treat a timer tick as no_connection_possible and log
In testing, due to other patches, I managed to flood the send queue with messages and cause us not to be able to send pings, thus getting a peer disconnected for ping timeout. To my surprise, this also force-closed all of my channels with that peeer. Obviously a ping timeout does not indicate that no future connection with said peer will be possible, and we shouldn't be force-closing channels as a result. This also logs when a peer is disconnected to ping timeout to make debug easier.
1 parent 364b586 commit ca0c723

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,10 +1087,15 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
10871087
descriptors_needing_disconnect.push(descriptor.clone());
10881088
match peer.their_node_id {
10891089
Some(node_id) => {
1090+
log_trace!(self, "Disconnecting peer with id {} due to ping timeout", node_id);
10901091
node_id_to_descriptor.remove(&node_id);
1091-
self.message_handler.chan_handler.peer_disconnected(&node_id, true);
1092+
self.message_handler.chan_handler.peer_disconnected(&node_id, false);
10921093
}
1093-
None => {}
1094+
None => {
1095+
// This can't actually happen as we should have hit
1096+
// is_ready_for_encryption() previously on this same peer.
1097+
unreachable!();
1098+
},
10941099
}
10951100
return false;
10961101
}

0 commit comments

Comments
 (0)