Refactor misleading log in discovery (#5679)

* Refactor misleading log

* Forgot to git add the compilation fix
This commit is contained in:
Pierre Krieger
2020-04-18 14:04:23 +02:00
committed by GitHub
parent cacba117f8
commit cff487dd22
+6 -8
View File
@@ -375,9 +375,10 @@ impl NetworkBehaviour for DiscoveryBehaviour {
list.extend(list_to_filter);
}
trace!(target: "sub-libp2p", "Addresses of {:?} are {:?}", peer_id, list);
if !list.is_empty() {
trace!(target: "sub-libp2p", "Addresses of {:?}: {:?}", peer_id, list);
if list.is_empty() {
} else {
let mut has_entry = false;
for k in self.kademlias.values_mut() {
if k.kbuckets_entries().any(|p| p == peer_id) {
@@ -386,15 +387,12 @@ impl NetworkBehaviour for DiscoveryBehaviour {
}
}
if has_entry {
debug!(target: "sub-libp2p",
"Requested dialing to {:?} (peer in k-buckets), and no address was found",
peer_id);
trace!(target: "sub-libp2p", "Addresses of {:?}: none (peer in k-buckets)", peer_id);
} else {
debug!(target: "sub-libp2p",
"Requested dialing to {:?} (peer not in k-buckets), and no address was found",
peer_id);
trace!(target: "sub-libp2p", "Addresses of {:?}: none (peer not in k-buckets)", peer_id);
}
}
list
}