mirror of
https://github.com/Bluemangoo/sekai-unpacker.git
synced 2026-05-06 20:44:47 +08:00
fix tcp server wait
This commit is contained in:
parent
59c50d5e08
commit
e00b25b6c7
@ -200,6 +200,16 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
if error.to_string().contains(REGION_NOT_FOUND) {
|
if error.to_string().contains(REGION_NOT_FOUND) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if error
|
||||||
|
.to_string()
|
||||||
|
.contains("Session did not reconnect within 15s")
|
||||||
|
{
|
||||||
|
error!(
|
||||||
|
"Session lost for profile {}. Waiting for a fresh tunnel endpoint...",
|
||||||
|
profile.0
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
error!("{}", error);
|
error!("{}", error);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@ -251,6 +261,16 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
if error
|
||||||
|
.to_string()
|
||||||
|
.contains("Session did not reconnect within 15s")
|
||||||
|
{
|
||||||
|
error!(
|
||||||
|
"Session lost for profile {}. Reconnecting tunnel...",
|
||||||
|
profile.0
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
error!("{}", error);
|
error!("{}", error);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ use crate::config::Profile;
|
|||||||
use crate::http::{close, download, sync};
|
use crate::http::{close, download, sync};
|
||||||
use common::http::{CloseRequest, DownloadRequest};
|
use common::http::{CloseRequest, DownloadRequest};
|
||||||
use communicator::ClientManager;
|
use communicator::ClientManager;
|
||||||
|
use anyhow::anyhow;
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -64,30 +65,42 @@ pub async fn run(
|
|||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
task: task.clone(),
|
task: task.clone(),
|
||||||
};
|
};
|
||||||
let result = download(&mut client.get_client().await.unwrap(), &req, &p1).await;
|
let mut conn = client.get_client().await?;
|
||||||
if let Err(e) = result
|
let mut result = download(&mut conn, &req, &p1).await;
|
||||||
&& let Some(_) = e.downcast_ref::<h2::Error>()
|
if let Err(e) = &result
|
||||||
|
&& e.downcast_ref::<h2::Error>().is_some()
|
||||||
{
|
{
|
||||||
download(&mut client.get_client().await.unwrap(), &req, &p1)
|
let mut retry_conn = client.get_client().await?;
|
||||||
.await
|
result = download(&mut retry_conn, &req, &p1).await;
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
|
result?;
|
||||||
|
|
||||||
local_manifest
|
local_manifest
|
||||||
.add_bundle(task.bundle_path.clone(), task.bundle_hash.clone())
|
.add_bundle(task.bundle_path.clone(), task.bundle_hash.clone())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
?;
|
||||||
drop(permit);
|
drop(permit);
|
||||||
|
Ok::<(), anyhow::Error>(())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let mut succeed = 0;
|
let mut succeed = 0;
|
||||||
let mut failed = 0;
|
let mut failed = 0;
|
||||||
while let Some(r) = join_set.join_next().await {
|
while let Some(r) = join_set.join_next().await {
|
||||||
if let Err(e) = r {
|
match r {
|
||||||
|
Ok(Ok(())) => {
|
||||||
|
succeed += 1;
|
||||||
|
}
|
||||||
|
Ok(Err(e)) => {
|
||||||
|
if e.to_string().contains("Session did not reconnect within 15s") {
|
||||||
|
return Err(anyhow!(e));
|
||||||
|
}
|
||||||
error!("{}", e);
|
error!("{}", e);
|
||||||
failed += 1;
|
failed += 1;
|
||||||
} else {
|
}
|
||||||
succeed += 1;
|
Err(e) => {
|
||||||
|
error!("{}", e);
|
||||||
|
failed += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local_manifest.save().await?;
|
local_manifest.save().await?;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user