Bugfix for NAT mode

This commit is contained in:
Mygod
2016-07-11 19:51:47 +08:00
parent 84ac2b06fa
commit 159e1dff78
@@ -55,14 +55,17 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext {
override def onServiceConnected() {
handler.postDelayed(() => if (bgService != null) {
if (app.isNatEnabled || VpnService.prepare(ShadowsocksRunnerService.this) == null) {
bgService.use(app.profileId)
bgService.getState // ensure the oneway call to use is finished
}
if (app.isNatEnabled) startBackgroundService()
else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService()
stopSelf()
}, 1000)
}
def startBackgroundService() = {
bgService.use(app.profileId)
bgService.getState // ensure the oneway call to use is finished
}
override def onCreate() {
super.onCreate()
attachService()