mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-22 14:59:09 +00:00
print error info
This commit is contained in:
parent
cfbc5fabb1
commit
bd27833c29
2 changed files with 12 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
use tun2proxy::{desktop_run_async, Args, BoxError};
|
||||
use tun2proxy::{Args, BoxError};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), BoxError> {
|
||||
|
@ -13,8 +13,8 @@ async fn main() -> Result<(), BoxError> {
|
|||
let join_handle = tokio::spawn({
|
||||
let shutdown_token = shutdown_token.clone();
|
||||
async move {
|
||||
if let Err(err) = desktop_run_async(args, shutdown_token).await {
|
||||
log::error!("desktop_run_async error: {}", err);
|
||||
if let Err(err) = tun2proxy::desktop_run_async(args, shutdown_token).await {
|
||||
log::error!("main loop error: {}", err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -51,9 +51,17 @@ pub unsafe extern "C" fn tun2proxy_run_with_name(
|
|||
args.bypass(bypass.parse().unwrap());
|
||||
}
|
||||
|
||||
let main_loop = async move {
|
||||
if let Err(err) = desktop_run_async(args, shutdown_token).await {
|
||||
log::error!("main loop error: {}", err);
|
||||
return Err(err);
|
||||
}
|
||||
Ok(())
|
||||
};
|
||||
|
||||
let exit_code = match tokio::runtime::Builder::new_multi_thread().enable_all().build() {
|
||||
Err(_e) => -3,
|
||||
Ok(rt) => match rt.block_on(desktop_run_async(args, shutdown_token)) {
|
||||
Ok(rt) => match rt.block_on(main_loop) {
|
||||
Ok(_) => 0,
|
||||
Err(_e) => -4,
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue