This commit is contained in:
open-trade 2022-01-05 15:47:04 +08:00
parent 5631ffac4c
commit 5f61c2442a
2 changed files with 3 additions and 5 deletions

View File

@ -4,7 +4,7 @@ use crate::{
udp::FramedSocket,
ResultType,
};
use anyhow::{bail, Context};
use anyhow::bail;
use std::net::SocketAddr;
use tokio::net::ToSocketAddrs;
use tokio_socks::{IntoTargetAddr, TargetAddr};
@ -69,9 +69,7 @@ pub async fn connect_tcp<'t, T: IntoTargetAddr<'t>>(
bail!("Invalid target addr");
};
FramedStream::new(addrs[0], local, ms_timeout)
.await
.with_context(|| "Failed to connect to rendezvous server")
Ok(FramedStream::new(addrs[0], local, ms_timeout).await?)
}
}

View File

@ -249,7 +249,7 @@ async fn test_nat_type_() -> ResultType<bool> {
if port == 0 {
bail!("Invalid server address: {}", server1);
}
let server2 = format!("{}:{}", tmp[0], port);
let server2 = format!("{}:{}", tmp[0], port - 1);
let mut msg_out = RendezvousMessage::new();
let serial = Config::get_serial();
msg_out.set_test_nat_request(TestNatRequest {