mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
dnetview: display null outbound connections as null instead of ignoring
This commit is contained in:
@@ -153,6 +153,7 @@ async fn poll(client: DnetView, model: Arc<Model>) -> DnetViewResult<()> {
|
||||
match client.get_info().await {
|
||||
Ok(reply) => {
|
||||
if reply.as_object().is_some() && !reply.as_object().unwrap().is_empty() {
|
||||
debug!("FROM {}", client.name);
|
||||
parse_data(reply.as_object().unwrap(), &client, model.clone()).await?;
|
||||
} else {
|
||||
return Err(DnetViewError::EmptyRpcReply)
|
||||
@@ -232,7 +233,6 @@ async fn parse_data(
|
||||
|
||||
let node_name = &client.name;
|
||||
let node_id = make_node_id(node_name)?;
|
||||
//let external_addr = ext_addr.unwrap().as_str().unwrap();
|
||||
|
||||
let ext_addr = parse_external_addr(addr).await?;
|
||||
let in_session = parse_inbound(inbound, &node_id).await?;
|
||||
@@ -498,14 +498,14 @@ async fn parse_outbound(outbound: &Value, node_id: &String) -> DnetViewResult<Se
|
||||
slot_count += 1;
|
||||
match slot["channel"].is_null() {
|
||||
true => {
|
||||
// channel is empty. initialize with empty values
|
||||
// TODO: this is not actually empty
|
||||
let id = make_empty_id(node_id, &session_type, slot_count)?;
|
||||
let addr = "Null".to_string();
|
||||
let state = &slot["state"];
|
||||
let state = state.as_str().unwrap().to_string();
|
||||
let parent = parent.clone();
|
||||
let msg_log = Vec::new();
|
||||
let is_empty = true;
|
||||
let is_empty = false;
|
||||
let last_msg = "Null".to_string();
|
||||
let last_status = "Null".to_string();
|
||||
let remote_node_id = "Null".to_string();
|
||||
|
||||
@@ -161,14 +161,28 @@ impl View {
|
||||
ids.push(session.id.clone());
|
||||
for connection in &session.children {
|
||||
let mut info = Vec::new();
|
||||
let name = Span::styled(
|
||||
format!(
|
||||
" {} ({})",
|
||||
connection.addr, connection.remote_node_id
|
||||
),
|
||||
style,
|
||||
);
|
||||
info.push(name);
|
||||
match connection.addr.as_str() {
|
||||
"Null" => {
|
||||
let style = Style::default()
|
||||
.fg(Color::Blue)
|
||||
.add_modifier(Modifier::ITALIC);
|
||||
let name = Span::styled(
|
||||
format!(" {} ", connection.addr),
|
||||
style,
|
||||
);
|
||||
info.push(name);
|
||||
}
|
||||
addr => {
|
||||
let name = Span::styled(
|
||||
format!(
|
||||
" {} ({})",
|
||||
addr, connection.remote_node_id
|
||||
),
|
||||
style,
|
||||
);
|
||||
info.push(name);
|
||||
}
|
||||
}
|
||||
match connection.last_status.as_str() {
|
||||
"recv" => {
|
||||
let msg = Span::styled(
|
||||
|
||||
Reference in New Issue
Block a user