Commit f1e1acbe authored by liusheng's avatar liusheng

Merge branch 'cc-dev' into 11a-dev

parents f7f175ee 0cd2a157
......@@ -199,6 +199,9 @@ object AcceleratorUtils {
override fun stateChanged(state: BaseService.State, profileName: String?, msg: String?) {
AcceleratorUtils.state = state
stateListener(state, getAccTime(), null)
if (state == BaseService.State.Stopped && !msg.isNullOrBlank()) {
ToastUtils.show(msg)
}
}
override fun onServiceConnected(service: IShadowsocksService) {
......
......@@ -21,6 +21,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import timber.log.Timber
import java.io.File
import java.io.IOException
import java.security.SecureRandom
import java.security.cert.X509Certificate
import java.util.concurrent.Executors
......@@ -83,6 +84,8 @@ object AuthManager {
MMKV.defaultMMKV().putLong("LAST_ACC_TIME", last_acc_time)
}
class AuthException(msg: String) : IOException(msg), BaseService.ExpectedException
suspend fun initAuthProfile(profile: Profile) {
withContext(Dispatchers.IO) {
getLineConfig()?.let {
......
......@@ -124,7 +124,14 @@ class GuardedProcessPool(private val onFatal: suspend (IOException) -> Unit) : C
) {
Guard(cmdSupplier).apply {
launch {
try {
start() // if start fails, IOException will be thrown directly
} catch (ex: Throwable) {
if (ex is AuthManager.AuthException) {
onFatal(ex)
return@launch
}
}
looper(onRestartCallback)
}
}
......
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