Commit 159e1dff authored by Mygod's avatar Mygod

Bugfix for NAT mode

parent 84ac2b06
......@@ -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()
......
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