mirror of https://github.com/ospab/ostp.git
Fix handshake timeouts in OSTP outbounds and remove test_parse
This commit is contained in:
parent
23c4d38ee4
commit
d65af355f1
|
|
@ -98,7 +98,7 @@ pub async fn dial_tcp(
|
||||||
let mut buf = [0u8; 8192];
|
let mut buf = [0u8; 8192];
|
||||||
let mut handshake_success = false;
|
let mut handshake_success = false;
|
||||||
match tokio::time::timeout(
|
match tokio::time::timeout(
|
||||||
std::time::Duration::from_millis(3000),
|
std::time::Duration::from_millis(15000),
|
||||||
transport.recv(&mut buf),
|
transport.recv(&mut buf),
|
||||||
).await {
|
).await {
|
||||||
Ok(Ok(n)) => {
|
Ok(Ok(n)) => {
|
||||||
|
|
@ -108,7 +108,7 @@ pub async fn dial_tcp(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tracing::warn!("TCP handshake timeout for {}:{}", server_str, port);
|
tracing::warn!("OSTP handshake timeout for {}:{}", server_str, port);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +133,7 @@ pub async fn dial_tcp(
|
||||||
// The kernel will buffer incoming data from server_stream while we wait.
|
// The kernel will buffer incoming data from server_stream while we wait.
|
||||||
let mut connect_ok = false;
|
let mut connect_ok = false;
|
||||||
match tokio::time::timeout(
|
match tokio::time::timeout(
|
||||||
std::time::Duration::from_secs(10),
|
std::time::Duration::from_secs(30),
|
||||||
async {
|
async {
|
||||||
let mut wait_buf = [0u8; 8192];
|
let mut wait_buf = [0u8; 8192];
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -247,14 +247,14 @@ pub async fn handle_udp(
|
||||||
// Wait for handshake response (server sends HandshakePayload back)
|
// Wait for handshake response (server sends HandshakePayload back)
|
||||||
let mut buf = [0u8; 8192];
|
let mut buf = [0u8; 8192];
|
||||||
match tokio::time::timeout(
|
match tokio::time::timeout(
|
||||||
std::time::Duration::from_millis(2000),
|
std::time::Duration::from_millis(15000),
|
||||||
transport.recv(&mut buf),
|
transport.recv(&mut buf),
|
||||||
).await {
|
).await {
|
||||||
Ok(Ok(n)) => {
|
Ok(Ok(n)) => {
|
||||||
let _ = machine.on_event(OstpEvent::Inbound(bytes::Bytes::copy_from_slice(&buf[..n])));
|
let _ = machine.on_event(OstpEvent::Inbound(bytes::Bytes::copy_from_slice(&buf[..n])));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tracing::warn!("UDP handshake timeout for {}:{}", server, port);
|
tracing::warn!("OSTP handshake timeout for {}:{}", server, port);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,3 @@ reqwest = { version = "0.12", default-features = false, features = ["blocking",
|
||||||
pico-args = "0.5.0"
|
pico-args = "0.5.0"
|
||||||
clipboard-win = "3.1.1"
|
clipboard-win = "3.1.1"
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "test_parse"
|
|
||||||
path = "../test_parse.rs"
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue