Compare commits

..
6 Commits
Author SHA1 Message Date
Max Lv 7b57be669c Bump version 2016-08-27 07:56:10 +08:00
Max Lv 2f051e9eed Update kcptun 2016-08-23 13:52:48 +08:00
Mygod 8d1d018fe1 Remove boot script to disable fast open
Fix #828.
2016-08-23 13:48:05 +08:00
Mygod 3c5bc27750 Refine mount command
Fix #826.
2016-08-22 21:10:41 +08:00
Mygod 6c047eca8e Add error message if failed 2016-08-22 21:10:33 +08:00
Max Lv a31e753841 Update golang 2016-08-21 11:14:09 +08:00
6 changed files with 30 additions and 13 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ export PATH=$GOROOT/bin:$PATH
pushd kcptun/client
echo "Get dependences for kcptun"
go get -u github.com/madeye/kcp-go
go get -u github.com/xtaci/kcp-go
go get
echo "Cross compile kcptun for arm"
+2 -2
View File
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
android:versionCode="147"
android:versionName="3.0.5">
android:versionCode="148"
android:versionName="3.0.6">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
@@ -7,6 +7,7 @@ import android.content.{Intent, SharedPreferences}
import android.net.Uri
import android.os.Bundle
import android.preference.{Preference, PreferenceFragment, SwitchPreference}
import android.support.design.widget.Snackbar
import android.support.v7.app.AlertDialog
import android.webkit.{WebView, WebViewClient}
import com.github.shadowsocks.ShadowsocksApplication.app
@@ -158,7 +159,9 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
tfo.setChecked(TcpFastOpen.sendEnabled)
tfo.setOnPreferenceChangeListener((_, v) => {
val value = v.asInstanceOf[Boolean]
TcpFastOpen.enabled(value)
val result = TcpFastOpen.enabled(value)
if (result != null && result != "Success.")
Snackbar.make(activity.findViewById(android.R.id.content), result, Snackbar.LENGTH_LONG).show()
value == TcpFastOpen.sendEnabled
})
if (!TcpFastOpen.supported) {
@@ -4,6 +4,8 @@ import java.io.File
import eu.chainfire.libsuperuser.Shell
import scala.collection.JavaConverters._
/**
* @author Mygod
*/
@@ -26,11 +28,23 @@ object TcpFastOpen {
file.canRead && (Utils.readAllLines(file).toInt & 1) > 0
}
def enabled(value: Boolean) = if (supported) {
val fastopen = "echo " + (if (value) 3 else 0) + " > /proc/sys/net/ipv4/tcp_fastopen"
Shell.SU.run(Array(
"mount -o remount,rw /system && " + fastopen + " && echo '#!/system/bin/sh\n" + fastopen +
"' > /etc/init.d/tcp_fastopen && chmod 755 /etc/init.d/tcp_fastopen",
"mount -o remount,ro /system"))
}
def enabled(value: Boolean) =
Shell.run("su", Array(
"if echo " + (if (value) 3 else 0) + " > /proc/sys/net/ipv4/tcp_fastopen; then",
" success=-1",
" if mount -o rw,remount /dev/block/platform/msm_sdcc.1/by-name/system /system; then",
if (value) " echo '#!/system/bin/sh\n" +
"echo 3 > /proc/sys/net/ipv4/tcp_fastopen' > /etc/init.d/tcp_fastopen && chmod 755 /etc/init.d/tcp_fastopen"
else "rm -f /etc/init.d/tcp_fastopen",
" success=$?",
" mount -o ro,remount /dev/block/platform/msm_sdcc.1/by-name/system /system",
" fi",
" if [ $success -eq 0 ]; then",
" echo Success.",
" else",
" echo Warning: Unable to create boot script.",
" fi",
"else",
" echo Failed.",
"fi"), null, true).asScala.mkString("\n")
}