mirror of
https://github.com/rustdesk/rustdesk-server.git
synced 2024-11-28 07:39:30 +08:00
refactored
This commit is contained in:
parent
af2ccf86c6
commit
defac1f338
@ -1 +1 @@
|
|||||||
Subproject commit 7814ff3a395bf063300317f28644b92712d501e4
|
Subproject commit 2cc3edf0f634adcb1e290c5c8b11bc21de38e763
|
@ -79,8 +79,7 @@ impl RendezvousServer {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use hbb_common::tokio;
|
use hbb_common::{new_error, tokio};
|
||||||
use std::io::{Error, ErrorKind};
|
|
||||||
|
|
||||||
#[allow(unused_must_use)]
|
#[allow(unused_must_use)]
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
@ -127,7 +126,7 @@ mod tests {
|
|||||||
if let Some(Ok((bytes, addr))) = socket_b.next_timeout(1000).await {
|
if let Some(Ok((bytes, addr))) = socket_b.next_timeout(1000).await {
|
||||||
assert_eq!(addr_server, addr);
|
assert_eq!(addr_server, addr);
|
||||||
let msg_in = parse_from_bytes::<Message>(&bytes)?;
|
let msg_in = parse_from_bytes::<Message>(&bytes)?;
|
||||||
let remote_addr_a = AddrMangle::decode(&msg_in.get_punch_hole().socket_addr[..]);
|
let remote_addr_a = AddrMangle::decode(&msg_in.get_punch_hole().socket_addr);
|
||||||
assert_eq!(local_addr_a, remote_addr_a);
|
assert_eq!(local_addr_a, remote_addr_a);
|
||||||
|
|
||||||
// B punch A
|
// B punch A
|
||||||
@ -150,14 +149,13 @@ mod tests {
|
|||||||
if let Some(Ok((bytes, addr))) = socket_a.next_timeout(1000).await {
|
if let Some(Ok((bytes, addr))) = socket_a.next_timeout(1000).await {
|
||||||
assert_eq!(addr_server, addr);
|
assert_eq!(addr_server, addr);
|
||||||
let msg_in = parse_from_bytes::<Message>(&bytes)?;
|
let msg_in = parse_from_bytes::<Message>(&bytes)?;
|
||||||
let remote_addr_b =
|
let remote_addr_b = AddrMangle::decode(&msg_in.get_punch_hole_response().socket_addr);
|
||||||
AddrMangle::decode(&msg_in.get_punch_hole_response().socket_addr[..]);
|
|
||||||
assert_eq!(local_addr_b, remote_addr_b);
|
assert_eq!(local_addr_b, remote_addr_b);
|
||||||
} else {
|
} else {
|
||||||
panic!("failed");
|
panic!("failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(Box::new(Error::new(ErrorKind::Other, "done")))
|
Err(new_error("done"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user