Commit 159e1dff authored by Mygod's avatar Mygod

Bugfix for NAT mode

parent 84ac2b06
...@@ -55,14 +55,17 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext { ...@@ -55,14 +55,17 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext {
override def onServiceConnected() { override def onServiceConnected() {
handler.postDelayed(() => if (bgService != null) { handler.postDelayed(() => if (bgService != null) {
if (app.isNatEnabled || VpnService.prepare(ShadowsocksRunnerService.this) == null) { if (app.isNatEnabled) startBackgroundService()
bgService.use(app.profileId) else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService()
bgService.getState // ensure the oneway call to use is finished
}
stopSelf() stopSelf()
}, 1000) }, 1000)
} }
def startBackgroundService() = {
bgService.use(app.profileId)
bgService.getState // ensure the oneway call to use is finished
}
override def onCreate() { override def onCreate() {
super.onCreate() super.onCreate()
attachService() 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