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.
descriptors_needing_disconnect.push(descriptor.clone());
match peer.their_node_id {
Some(node_id) => {
+ log_trace!(self, "Disconnecting peer with id {} due to ping timeout", node_id);
node_id_to_descriptor.remove(&node_id);
- self.message_handler.chan_handler.peer_disconnected(&node_id, true);
+ self.message_handler.chan_handler.peer_disconnected(&node_id, false);
}
- None => {}
+ None => {
+ // This can't actually happen as we should have hit
+ // is_ready_for_encryption() previously on this same peer.
+ unreachable!();
+ },
}
return false;
}