mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-16 14:47:25 +08:00
fix upx and udp conn counter (#131)
* fix upx in workflow * fix udp conn counter
This commit is contained in:
@@ -758,9 +758,10 @@ mod tests {
|
||||
peers::{
|
||||
peer_manager::RouteAlgoType,
|
||||
peer_rpc::tests::{MockService, TestRpcService, TestRpcServiceClient},
|
||||
tests::{connect_peer_manager, wait_for_condition, wait_route_appear},
|
||||
tests::{connect_peer_manager, wait_route_appear},
|
||||
},
|
||||
rpc::NatType,
|
||||
tunnel::common::tests::wait_for_condition,
|
||||
tunnel::{TunnelConnector, TunnelListener},
|
||||
};
|
||||
|
||||
|
||||
@@ -1467,9 +1467,10 @@ mod tests {
|
||||
peers::{
|
||||
peer_manager::{PeerManager, RouteAlgoType},
|
||||
route_trait::{NextHopPolicy, Route, RouteCostCalculatorInterface},
|
||||
tests::{connect_peer_manager, wait_for_condition},
|
||||
tests::connect_peer_manager,
|
||||
},
|
||||
rpc::NatType,
|
||||
tunnel::common::tests::wait_for_condition,
|
||||
};
|
||||
|
||||
use super::PeerRoute;
|
||||
|
||||
@@ -557,14 +557,11 @@ pub mod tests {
|
||||
common::{error::Error, new_peer_id, PeerId},
|
||||
peers::{
|
||||
peer_rpc::PeerRpcManager,
|
||||
tests::{
|
||||
connect_peer_manager, create_mock_peer_manager, wait_for_condition,
|
||||
wait_route_appear,
|
||||
},
|
||||
tests::{connect_peer_manager, create_mock_peer_manager, wait_route_appear},
|
||||
},
|
||||
tunnel::{
|
||||
packet_def::ZCPacket, ring::create_ring_tunnel_pair, Tunnel, ZCPacketSink,
|
||||
ZCPacketStream,
|
||||
common::tests::wait_for_condition, packet_def::ZCPacket, ring::create_ring_tunnel_pair,
|
||||
Tunnel, ZCPacketSink, ZCPacketStream,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use futures::Future;
|
||||
|
||||
use crate::{
|
||||
common::{error::Error, global_ctx::tests::get_mock_global_ctx, PeerId},
|
||||
tunnel::ring::create_ring_tunnel_pair,
|
||||
@@ -58,18 +56,3 @@ pub async fn wait_route_appear(
|
||||
wait_route_appear_with_cost(peer_mgr.clone(), target_peer.my_peer_id(), None).await?;
|
||||
wait_route_appear_with_cost(target_peer, peer_mgr.my_peer_id(), None).await
|
||||
}
|
||||
|
||||
pub async fn wait_for_condition<F, FRet>(mut condition: F, timeout: std::time::Duration) -> ()
|
||||
where
|
||||
F: FnMut() -> FRet + Send,
|
||||
FRet: Future<Output = bool>,
|
||||
{
|
||||
let now = std::time::Instant::now();
|
||||
while now.elapsed() < timeout {
|
||||
if condition().await {
|
||||
return;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
|
||||
}
|
||||
assert!(condition().await, "Timeout")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user