Add support for TCP Fast Open (#809)
* Add support for TCP Fast Open * Remove useless echo done line * Check return values before proceeding in TcpFastOpen.enabled
This commit is contained in:
@@ -12,7 +12,7 @@ import android.webkit.{WebView, WebViewClient}
|
||||
import com.github.shadowsocks.ShadowsocksApplication.app
|
||||
import com.github.shadowsocks.database.Profile
|
||||
import com.github.shadowsocks.preferences._
|
||||
import com.github.shadowsocks.utils.{Key, Utils}
|
||||
import com.github.shadowsocks.utils.{Key, TcpFastOpen, Utils}
|
||||
|
||||
object ShadowsocksSettings {
|
||||
// Constants
|
||||
@@ -154,6 +154,18 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
|
||||
}
|
||||
switch.setChecked(BootReceiver.getEnabled(activity))
|
||||
|
||||
val tfo = findPreference("tcp_fastopen").asInstanceOf[SwitchPreference]
|
||||
tfo.setChecked(TcpFastOpen.sendEnabled)
|
||||
tfo.setOnPreferenceChangeListener((_, v) => {
|
||||
val value = v.asInstanceOf[Boolean]
|
||||
TcpFastOpen.enabled(value)
|
||||
value == TcpFastOpen.sendEnabled
|
||||
})
|
||||
if (!TcpFastOpen.supported) {
|
||||
tfo.setEnabled(false)
|
||||
tfo.setSummary(getString(R.string.tcp_fastopen_summary_unsupported, java.lang.System.getProperty("os.version")))
|
||||
}
|
||||
|
||||
findPreference("recovery").setOnPreferenceClickListener((preference: Preference) => {
|
||||
app.track(TAG, "reset")
|
||||
activity.recovery()
|
||||
|
||||
Reference in New Issue
Block a user