Skip to content

Commit 34af6ae

Browse files
committed
refine the IPC to tun2socks
1 parent d9af2f9 commit 34af6ae

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resolvers += Resolver.url("scalasbt releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
22

3-
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.4.6")
3+
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.4.7")
44

55
resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
66

src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.github.shadowsocks"
3-
android:versionCode="110"
4-
android:versionName="2.7.2">
3+
android:versionCode="111"
4+
android:versionName="2.7.3">
55

66
<uses-permission android:name="android.permission.INTERNET"/>
77
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,17 +266,18 @@ class ShadowsocksVpnService extends VpnService with BaseService {
266266
}
267267

268268
val fd = startVpn()
269-
if (fd == -1) {
270-
false
271-
} else {
272-
Thread.sleep(1000)
273-
if (System.sendfd(fd) == -1) {
274-
false
275-
} else {
276-
true
269+
270+
if (fd != -1) {
271+
var tries = 1
272+
while (tries < 5) {
273+
Thread.sleep(1000 * tries)
274+
if (System.sendfd(fd) != -1) {
275+
return true
276+
}
277+
tries += 1
277278
}
278279
}
279-
280+
false
280281
}
281282

282283
def startShadowsocksDaemon() {

0 commit comments

Comments
 (0)