diff options
author | open-trade <[email protected]> | 2020-03-10 14:38:10 +0800 |
---|---|---|
committer | open-trade <[email protected]> | 2020-03-10 14:38:10 +0800 |
commit | defac1f338573e705b890dd351d55dc7aa67b8dd (patch) | |
tree | d47a2d4b8d6d4a44c622fc805aaff19717ec5afc /src | |
parent | af2ccf86c62e228e7d322b3c2a5aec96405ed71a (diff) | |
download | rustdesk-server-defac1f338573e705b890dd351d55dc7aa67b8dd.tar.gz rustdesk-server-defac1f338573e705b890dd351d55dc7aa67b8dd.zip |
refactored
Diffstat (limited to 'src')
-rw-r--r-- | src/rendezvous_server.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs index 12ff0a4..d1adca4 100644 --- a/src/rendezvous_server.rs +++ b/src/rendezvous_server.rs @@ -79,8 +79,7 @@ impl RendezvousServer { #[cfg(test)] mod tests { use super::*; - use hbb_common::tokio; - use std::io::{Error, ErrorKind}; + use hbb_common::{new_error, tokio}; #[allow(unused_must_use)] #[tokio::main] @@ -127,7 +126,7 @@ mod tests { if let Some(Ok((bytes, addr))) = socket_b.next_timeout(1000).await { assert_eq!(addr_server, addr); 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); // B punch A @@ -150,14 +149,13 @@ mod tests { if let Some(Ok((bytes, addr))) = socket_a.next_timeout(1000).await { assert_eq!(addr_server, addr); let msg_in = parse_from_bytes::<Message>(&bytes)?; - let remote_addr_b = - AddrMangle::decode(&msg_in.get_punch_hole_response().socket_addr[..]); + let remote_addr_b = AddrMangle::decode(&msg_in.get_punch_hole_response().socket_addr); assert_eq!(local_addr_b, remote_addr_b); } else { panic!("failed"); } - Err(Box::new(Error::new(ErrorKind::Other, "done"))) + Err(new_error("done")) } #[test] |