Bugfix for NAT mode
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user