Skip to content

Commit

Permalink
refine the IPC to tun2socks
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Jul 28, 2015
1 parent d9af2f9 commit 34af6ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resolvers += Resolver.url("scalasbt releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks"
android:versionCode="110"
android:versionName="2.7.2">
android:versionCode="111"
android:versionName="2.7.3">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Expand Down
19 changes: 10 additions & 9 deletions src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 34af6ae

Please sign in to comment.