mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-16 22:57:24 +08:00
nat4-nat4 punch (#388)
this patch optimize the udp hole punch logic: 1. allow start punch hole before stun test complete. 2. add lock to symmetric punch, avoid conflict between concurrent hole punching task. 3. support punching hole for predictable nat4-nat4. 4. make backoff of retry reasonable
This commit is contained in:
@@ -224,7 +224,10 @@ pub mod tests {
|
||||
|
||||
let msg = random_string(8192);
|
||||
let ret = stub
|
||||
.say_hello(RpcController {}, SayHelloRequest { name: msg.clone() })
|
||||
.say_hello(
|
||||
RpcController::default(),
|
||||
SayHelloRequest { name: msg.clone() },
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -233,7 +236,10 @@ pub mod tests {
|
||||
|
||||
let msg = random_string(10);
|
||||
let ret = stub
|
||||
.say_hello(RpcController {}, SayHelloRequest { name: msg.clone() })
|
||||
.say_hello(
|
||||
RpcController::default(),
|
||||
SayHelloRequest { name: msg.clone() },
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -281,7 +287,10 @@ pub mod tests {
|
||||
);
|
||||
|
||||
let ret = stub
|
||||
.say_hello(RpcController {}, SayHelloRequest { name: msg.clone() })
|
||||
.say_hello(
|
||||
RpcController::default(),
|
||||
SayHelloRequest { name: msg.clone() },
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(ret.greeting, format!("Hello {}!", msg));
|
||||
@@ -289,14 +298,20 @@ pub mod tests {
|
||||
// call again
|
||||
let msg = random_string(16 * 1024);
|
||||
let ret = stub
|
||||
.say_hello(RpcController {}, SayHelloRequest { name: msg.clone() })
|
||||
.say_hello(
|
||||
RpcController::default(),
|
||||
SayHelloRequest { name: msg.clone() },
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(ret.greeting, format!("Hello {}!", msg));
|
||||
|
||||
let msg = random_string(16 * 1024);
|
||||
let ret = stub
|
||||
.say_hello(RpcController {}, SayHelloRequest { name: msg.clone() })
|
||||
.say_hello(
|
||||
RpcController::default(),
|
||||
SayHelloRequest { name: msg.clone() },
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(ret.greeting, format!("Hello {}!", msg));
|
||||
@@ -340,13 +355,19 @@ pub mod tests {
|
||||
|
||||
let msg = random_string(16 * 1024);
|
||||
let ret = stub1
|
||||
.say_hello(RpcController {}, SayHelloRequest { name: msg.clone() })
|
||||
.say_hello(
|
||||
RpcController::default(),
|
||||
SayHelloRequest { name: msg.clone() },
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(ret.greeting, format!("Hello {}!", msg));
|
||||
|
||||
let ret = stub2
|
||||
.say_hello(RpcController {}, SayHelloRequest { name: msg.clone() })
|
||||
.say_hello(
|
||||
RpcController::default(),
|
||||
SayHelloRequest { name: msg.clone() },
|
||||
)
|
||||
.await;
|
||||
assert!(ret.is_err() && ret.unwrap_err().to_string().contains("Timeout"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user