Commit 95b13d5b authored by chenhuaqing's avatar chenhuaqing

exit fastly for incorrect token

parent e6836579
......@@ -72,6 +72,7 @@ class GuardedProcessPool(private val onFatal: suspend (IOException) -> Unit) : C
val exitCode = exitChannel.receive()
running = false
when {
exitCode == OsConstants.ECONNREFUSED -> throw IOException("connection refused by server")
SystemClock.elapsedRealtime() - startTime < 1000 -> throw IOException(
"$cmdName exits too fast (exit code: $exitCode)")
exitCode == 128 + OsConstants.SIGKILL -> Timber.w("$cmdName was killed")
......
......@@ -1537,6 +1537,7 @@ dependencies = [
"env_logger",
"futures",
"jemallocator",
"libc",
"log",
"log4rs",
"mimalloc",
......
......@@ -118,6 +118,7 @@ aead-cipher-extra = ["shadowsocks-service/aead-cipher-extra"]
[dependencies]
log = "0.4"
log4rs = { version = "1.0", optional = true }
libc = "0.2.94"
clap = { version = "2", features = ["wrap_help", "suggestions"] }
cfg-if = "1"
......
......@@ -344,7 +344,10 @@ fn main() {
}
}
#[cfg(all(feature = "local-dns", any(target_os = "android", target_os = "macos", target_os = "linux")))]
#[cfg(all(
feature = "local-dns",
any(target_os = "android", target_os = "macos", target_os = "linux")
))]
if protocol != ProtocolType::Dns {
// Start a DNS local server binding to DNS_LOCAL_ADDR
//
......@@ -502,7 +505,12 @@ fn main() {
// Server future resolved without an error. This should never happen.
Either::Left((Ok(..), ..)) => panic!("server exited unexpectly"),
// Server future resolved with error, which are listener errors in most cases
Either::Left((Err(err), ..)) => panic!("aborted with {}", err),
Either::Left((Err(err), ..)) => {
if err.kind() == std::io::ErrorKind::ConnectionRefused {
std::process::exit(libc::ECONNREFUSED)
}
panic!("aborted with {}", err)
}
// The abort signal future resolved. Means we should just exit.
Either::Right(_) => (),
}
......
include(":core", ":plugin", ":mobile", ":tv")
include(":core", ":plugin", ":mobile")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment