refactor done for native

This commit is contained in:
John Smith
2021-12-24 18:02:53 -05:00
parent 922470365a
commit 23abaa3c99
14 changed files with 266 additions and 350 deletions
+2 -7
View File
@@ -49,12 +49,7 @@ impl NodeRef {
// Returns the best dial info to attempt a connection to this node
pub fn best_dial_info(&self) -> Option<DialInfo> {
let nm = self.routing_table.network_manager();
let protocol_config = nm.get_protocol_config();
if protocol_config.is_none() {
return None;
}
let protocol_config = protocol_config.unwrap();
let protocol_config = nm.get_protocol_config()?;
self.operate(|e| {
e.first_filtered_dial_info(|di| {
// Does it match the dial info filter
@@ -99,7 +94,7 @@ impl Clone for NodeRef {
impl fmt::Debug for NodeRef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let out = format!("{}", self.node_id.encode());
let mut out = self.node_id.encode();
if !self.dial_info_filter.is_empty() {
out += &format!("{:?}", self.dial_info_filter);
}