refine the IPC to tun2socks

This commit is contained in:
Max Lv
2015-07-28 14:48:21 +08:00
parent d9af2f93e0
commit 34af6aeef5
3 changed files with 13 additions and 12 deletions
@@ -266,17 +266,18 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
val fd = startVpn()
if (fd == -1) {
false
} else {
Thread.sleep(1000)
if (System.sendfd(fd) == -1) {
false
} else {
true
if (fd != -1) {
var tries = 1
while (tries < 5) {
Thread.sleep(1000 * tries)
if (System.sendfd(fd) != -1) {
return true
}
tries += 1
}
}
false
}
def startShadowsocksDaemon() {