mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-14 05:37:23 +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());
|
query.shuffle(&mut rand::thread_rng());
|
||||||
if query.is_empty() {
|
if query.is_empty() {
|
||||||
return Err(Error::InvalidUrl(format!(
|
return Err(Error::InvalidUrl(format!(
|
||||||
"no valid connector url found in url: url: {}",
|
"no valid connector url found in url: {}",
|
||||||
url
|
url
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
@@ -130,9 +130,10 @@ impl HttpTunnelConnector {
|
|||||||
return create_connector_by_url(line, &self.global_ctx).await;
|
return create_connector_by_url(line, &self.global_ctx).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(Error::InvalidUrl(
|
Err(Error::InvalidUrl(format!(
|
||||||
"no valid connector url found".to_string(),
|
"no valid connector url found, response body: {}",
|
||||||
))
|
body
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(ret)]
|
#[tracing::instrument(ret)]
|
||||||
@@ -155,7 +156,7 @@ impl HttpTunnelConnector {
|
|||||||
|
|
||||||
Request::new(&uri)
|
Request::new(&uri)
|
||||||
.redirect_policy(RedirectPolicy::Limit(0))
|
.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())
|
.send(&mut *body_clone.write().unwrap())
|
||||||
.with_context(|| format!("sending http request failed. url: {}", uri))
|
.with_context(|| format!("sending http request failed. url: {}", uri))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -366,7 +366,8 @@ impl ManualConnectorManager {
|
|||||||
)));
|
)));
|
||||||
for ip_version in ip_versions {
|
for ip_version in ip_versions {
|
||||||
let ret = timeout(
|
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(
|
Self::conn_reconnect_with_ip_version(
|
||||||
data.clone(),
|
data.clone(),
|
||||||
dead_url.clone(),
|
dead_url.clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user