diff --git a/build.sbt b/build.sbt index 9232e1ff..bb6e85ee 100644 --- a/build.sbt +++ b/build.sbt @@ -41,7 +41,7 @@ libraryDependencies ++= Seq( "com.j256.ormlite" % "ormlite-android" % "5.0", "com.twofortyfouram" % "android-plugin-api-for-locale" % "1.0.2", "dnsjava" % "dnsjava" % "2.1.7", - "eu.chainfire" % "libsuperuser" % "1.0.0.201607041850", + "eu.chainfire" % "libsuperuser" % "1.0.0.201608240809", "me.dm7.barcodescanner" % "zxing" % "1.9", "net.glxn.qrgen" % "android" % "2.0" ) diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala index 86c181ab..30dcbed6 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala @@ -304,23 +304,15 @@ class ShadowsocksNatService extends BaseService { su.addCommand((init_sb ++ http_sb).toArray) } - override def startRunner(profile: Profile) = if (su == null) { + override def startRunner(profile: Profile) = if (su == null) su = new Shell.Builder().useSU().setWantSTDERR(true).setWatchdogTimeout(10).open((_, exitCode, _) => if (exitCode == 0) super.startRunner(profile) else { if (su != null) { - Log.wtf(TAG, "libsuperuser#55 has been fixed. Please remove the redundant code.") su.close() su = null } super.stopRunner(true, getString(R.string.nat_no_root)) }) - su.waitForIdle() - if (!su.isRunning) { - su.close() - su = null - super.stopRunner(true, getString(R.string.nat_no_root)) - } - } override def connect() { super.connect()