Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
xutianyi1999 committed Jun 9, 2023
1 parent d5a7808 commit 0498ba3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1400,12 +1400,12 @@ pub(crate) async fn info(api_addr: &str, info_type: NodeInfoType) -> Result<()>
table.add_row(row!["UDP_LATENCY", format!("{:?}", info.server_udp_hc.elapsed)]);

let udp_loss_rate = info.server_udp_hc.packet_loss_count as f32 / info.server_udp_hc.send_count as f32 * 100f32;
table.add_row(row!["UDP_LOSS_RATE", ternary!(udp_loss_rate.is_normal(), format!("{}%", udp_loss_rate), String::new())]);
table.add_row(row!["UDP_LOSS_RATE", ternary!(!udp_loss_rate.is_nan(), format!("{}%", udp_loss_rate), String::new())]);

table.add_row(row!["TCP_LATENCY", format!("{:?}", info.server_tcp_hc.elapsed)]);

let tcp_loss_rate = info.server_tcp_hc.packet_loss_count as f32 / info.server_tcp_hc.send_count as f32 * 100f32;
table.add_row(row!["TCP_LOSS_RATE", ternary!(tcp_loss_rate.is_normal(), format!("{}%", tcp_loss_rate), String::new())]);
table.add_row(row!["TCP_LOSS_RATE", ternary!(!tcp_loss_rate.is_nan(), format!("{}%", tcp_loss_rate), String::new())]);

break;
}
Expand Down Expand Up @@ -1446,7 +1446,7 @@ pub(crate) async fn info(api_addr: &str, info_type: NodeInfoType) -> Result<()>
table.add_row(row!["LATENCY", format!("{:?}", node.hc.elapsed)]);

let loss_rate = node.hc.packet_loss_count as f32 / node.hc.send_count as f32 * 100f32;
table.add_row(row!["LOSS_RATE", ternary!(loss_rate.is_normal(), format!("{}%", loss_rate), String::new())]);
table.add_row(row!["LOSS_RATE", ternary!(!loss_rate.is_nan(), format!("{}%", loss_rate), String::new())]);
}

break;
Expand Down
4 changes: 2 additions & 2 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,12 +1004,12 @@ pub(crate) async fn info(api_addr: &str, info_type: ServerInfoType) -> Result<()
table.add_row(row!["UDP_LATENCY", format!("{:?}", node.udp_heartbeat_cache.elapsed)]);

let udp_loss_rate = node.udp_heartbeat_cache.packet_loss_count as f32 / node.udp_heartbeat_cache.send_count as f32 * 100f32;
table.add_row(row!["UDP_LOSS_RATE", ternary!(udp_loss_rate.is_normal(), format!("{}%", udp_loss_rate), String::new())]);
table.add_row(row!["UDP_LOSS_RATE", ternary!(!udp_loss_rate.is_nan(), format!("{}%", udp_loss_rate), String::new())]);

table.add_row(row!["TCP_LATENCY", format!("{:?}", node.tcp_heartbeat_cache.elapsed)]);

let tcp_loss_rate = node.tcp_heartbeat_cache.packet_loss_count as f32 / node.tcp_heartbeat_cache.send_count as f32 * 100f32;
table.add_row(row!["TCP_LOSS_RATE", ternary!(tcp_loss_rate.is_normal(), format!("{}%", tcp_loss_rate), String::new())]);
table.add_row(row!["TCP_LOSS_RATE", ternary!(!tcp_loss_rate.is_nan(), format!("{}%", tcp_loss_rate), String::new())]);
}
break;
}
Expand Down

0 comments on commit 0498ba3

Please sign in to comment.