Skip to content

Commit de24150

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 440129c commit de24150

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
@@ -1089,10 +1089,15 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
10891089
descriptors_needing_disconnect.push(descriptor.clone());
10901090
match peer.their_node_id {
10911091
Some(node_id) => {
1092+
log_trace!(self, "Disconnecting peer with id {} due to ping timeout", node_id);
10921093
node_id_to_descriptor.remove(&node_id);
1093-
self.message_handler.chan_handler.peer_disconnected(&node_id, true);
1094+
self.message_handler.chan_handler.peer_disconnected(&node_id, false);
10941095
}
1095-
None => {}
1096+
None => {
1097+
// This can't actually happen as we should have hit
1098+
// is_ready_for_encryption() previously on this same peer.
1099+
unreachable!();
1100+
},
10961101
}
10971102
return false;
10981103
}

0 commit comments

Comments
 (0)