add timeout for wss try_accept

public server should show stats

use default values for flags

bump version to 2.0.0
This commit is contained in:
sijie.sun
2024-09-27 21:42:11 +08:00
committed by Sijie.Sun
parent ff5ee8a05e
commit d0a3a40a0f
9 changed files with 65 additions and 17 deletions

View File

@@ -23,7 +23,15 @@ impl PeerManagerRpcService {
}
pub async fn list_peers(&self) -> Vec<PeerInfo> {
let peers = self.peer_manager.get_peer_map().list_peers().await;
let mut peers = self.peer_manager.get_peer_map().list_peers().await;
peers.extend(
self.peer_manager
.get_foreign_network_client()
.get_peer_map()
.list_peers()
.await
.iter(),
);
let mut peer_infos = Vec::new();
for peer in peers {
let mut peer_info = PeerInfo::default();
@@ -31,6 +39,14 @@ impl PeerManagerRpcService {
if let Some(conns) = self.peer_manager.get_peer_map().list_peer_conns(peer).await {
peer_info.conns = conns;
} else if let Some(conns) = self
.peer_manager
.get_foreign_network_client()
.get_peer_map()
.list_peer_conns(peer)
.await
{
peer_info.conns = conns;
}
peer_infos.push(peer_info);