mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-13 21:27:25 +08:00
make http connector timeout longer
http response may be slow, make its timeout longer.
This commit is contained in:
@@ -88,7 +88,7 @@ impl HttpTunnelConnector {
|
||||
query.shuffle(&mut rand::thread_rng());
|
||||
if query.is_empty() {
|
||||
return Err(Error::InvalidUrl(format!(
|
||||
"no valid connector url found in url: url: {}",
|
||||
"no valid connector url found in url: {}",
|
||||
url
|
||||
)));
|
||||
}
|
||||
@@ -130,9 +130,10 @@ impl HttpTunnelConnector {
|
||||
return create_connector_by_url(line, &self.global_ctx).await;
|
||||
}
|
||||
|
||||
Err(Error::InvalidUrl(
|
||||
"no valid connector url found".to_string(),
|
||||
))
|
||||
Err(Error::InvalidUrl(format!(
|
||||
"no valid connector url found, response body: {}",
|
||||
body
|
||||
)))
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret)]
|
||||
@@ -155,7 +156,7 @@ impl HttpTunnelConnector {
|
||||
|
||||
Request::new(&uri)
|
||||
.redirect_policy(RedirectPolicy::Limit(0))
|
||||
.timeout(std::time::Duration::from_secs(5))
|
||||
.timeout(std::time::Duration::from_secs(60))
|
||||
.send(&mut *body_clone.write().unwrap())
|
||||
.with_context(|| format!("sending http request failed. url: {}", uri))
|
||||
})
|
||||
|
||||
@@ -366,7 +366,8 @@ impl ManualConnectorManager {
|
||||
)));
|
||||
for ip_version in ip_versions {
|
||||
let ret = timeout(
|
||||
std::time::Duration::from_secs(1),
|
||||
// allow http connector to wait longer
|
||||
std::time::Duration::from_secs(if dead_url.starts_with("http") { 20 } else { 1 }),
|
||||
Self::conn_reconnect_with_ip_version(
|
||||
data.clone(),
|
||||
dead_url.clone(),
|
||||
|
||||
Reference in New Issue
Block a user