1
0
mirror of https://github.com/Bluemangoo/sekai-unpacker.git synced 2026-05-06 20:44:47 +08:00

client reuse connection

This commit is contained in:
Bluemangoo 2026-04-10 17:28:44 +08:00
parent 7accb43048
commit 0a4f6338a6
Signed by: Bluemangoo
GPG Key ID: F2F7E46880A1C4CF
3 changed files with 45 additions and 29 deletions

View File

@ -100,11 +100,15 @@ async fn main() -> anyhow::Result<()> {
continue;
};
if let TunnelEndpoint::Client(client) = endpoint {
loop {
if client.get_client().await.is_err() {
break;
}
if cancel_token.is_cancelled() {
return;
}
let permit = semaphore.clone().acquire_owned().await.unwrap();
let result = run(client, profile.clone()).await;
let result = run(client.clone(), profile.clone()).await;
match result {
Ok(true) => {
post_task(profile.clone(), permit, cancel_token.clone()).await;
@ -116,6 +120,7 @@ async fn main() -> anyhow::Result<()> {
}
}
}
}
}));
}
@ -139,11 +144,15 @@ async fn main() -> anyhow::Result<()> {
continue;
};
if let TunnelEndpoint::Client(client) = endpoint {
loop {
if client.get_client().await.is_err() {
break;
}
if cancel_token.is_cancelled() {
return;
}
let permit = semaphore.clone().acquire_owned().await.unwrap();
let result = run(client, profile.clone()).await;
let result = run(client.clone(), profile.clone()).await;
match result {
Ok(true) => {
post_task(profile.clone(), permit, cancel_token.clone()).await;
@ -154,6 +163,7 @@ async fn main() -> anyhow::Result<()> {
_ => {}
}
}
}
sleep(Duration::from_secs(10)).await;
}
}));

View File

@ -1,9 +1,13 @@
log_level: "DEBUG"
client:
- url: "127.0.0.1:3333"
#client:
# - url: "127.0.0.1:3333"
# token: abc
server:
- url: 127.0.0.1:3333
token: abc
host: "local.bluemangoo.net"
cert: "D:\\WorkDir\\Nginx\\cert\\_.bluemangoo.net\\_.bluemangoo.net-chain.pem"
key: "D:\\WorkDir\\Nginx\\cert\\_.bluemangoo.net\\_.bluemangoo.net-key.pem"
profiles:
cn:

View File

@ -1,10 +1,12 @@
log_level: "DEBUG"
server:
- url: 127.0.0.1:3333
client:
- url: "127.0.0.1:3333"
token: abc
cert: "D:\\WorkDir\\Nginx\\cert\\_.bluemangoo.net\\_.bluemangoo.net-chain.pem"
key: "D:\\WorkDir\\Nginx\\cert\\_.bluemangoo.net\\_.bluemangoo.net-key.pem"
host: "local.bluemangoo.net"
#server:
# - url: 127.0.0.1:3333
# token: abc
execution:
proxy: ""