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:
parent
7accb43048
commit
0a4f6338a6
@ -100,11 +100,15 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
if let TunnelEndpoint::Client(client) = endpoint {
|
if let TunnelEndpoint::Client(client) = endpoint {
|
||||||
|
loop {
|
||||||
|
if client.get_client().await.is_err() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if cancel_token.is_cancelled() {
|
if cancel_token.is_cancelled() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let permit = semaphore.clone().acquire_owned().await.unwrap();
|
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 {
|
match result {
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
post_task(profile.clone(), permit, cancel_token.clone()).await;
|
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;
|
continue;
|
||||||
};
|
};
|
||||||
if let TunnelEndpoint::Client(client) = endpoint {
|
if let TunnelEndpoint::Client(client) = endpoint {
|
||||||
|
loop {
|
||||||
|
if client.get_client().await.is_err() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if cancel_token.is_cancelled() {
|
if cancel_token.is_cancelled() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let permit = semaphore.clone().acquire_owned().await.unwrap();
|
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 {
|
match result {
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
post_task(profile.clone(), permit, cancel_token.clone()).await;
|
post_task(profile.clone(), permit, cancel_token.clone()).await;
|
||||||
@ -154,6 +163,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
sleep(Duration::from_secs(10)).await;
|
sleep(Duration::from_secs(10)).await;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
log_level: "DEBUG"
|
log_level: "DEBUG"
|
||||||
|
|
||||||
client:
|
#client:
|
||||||
- url: "127.0.0.1:3333"
|
# - url: "127.0.0.1:3333"
|
||||||
|
# token: abc
|
||||||
|
server:
|
||||||
|
- url: 127.0.0.1:3333
|
||||||
token: abc
|
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:
|
profiles:
|
||||||
cn:
|
cn:
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
log_level: "DEBUG"
|
log_level: "DEBUG"
|
||||||
|
|
||||||
server:
|
client:
|
||||||
- url: 127.0.0.1:3333
|
- url: "127.0.0.1:3333"
|
||||||
token: abc
|
token: abc
|
||||||
cert: "D:\\WorkDir\\Nginx\\cert\\_.bluemangoo.net\\_.bluemangoo.net-chain.pem"
|
host: "local.bluemangoo.net"
|
||||||
key: "D:\\WorkDir\\Nginx\\cert\\_.bluemangoo.net\\_.bluemangoo.net-key.pem"
|
#server:
|
||||||
|
# - url: 127.0.0.1:3333
|
||||||
|
# token: abc
|
||||||
|
|
||||||
execution:
|
execution:
|
||||||
proxy: ""
|
proxy: ""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user