aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authoropen-trade <[email protected]>2020-03-10 14:38:10 +0800
committeropen-trade <[email protected]>2020-03-10 14:38:10 +0800
commitdefac1f338573e705b890dd351d55dc7aa67b8dd (patch)
treed47a2d4b8d6d4a44c622fc805aaff19717ec5afc /src
parentaf2ccf86c62e228e7d322b3c2a5aec96405ed71a (diff)
downloadrustdesk-server-defac1f338573e705b890dd351d55dc7aa67b8dd.tar.gz
rustdesk-server-defac1f338573e705b890dd351d55dc7aa67b8dd.zip
refactored
Diffstat (limited to 'src')
-rw-r--r--src/rendezvous_server.rs10
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]