New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable TCP KeepAlive by default #546
Comments
15秒可能消耗过多的电量在移动平台设备,如何在命令行中配置它? |
Try with this commit and specify keep alive timeouts with command line options like |
➜ ~ sslocal -U --protocol redir --tcp-fast-open --tcp-no-delay --tcp-keep-alive 300 -s server -m aes-256-gcm -k -b 0.0.0.0:12345 |
You should either compile from the latest master branch, or download the nightly build of v1.11.2. |
According to this, Android will not respect TCP keep alive settings when device goes to sleep. |
So, @om2mo your assumption doesn't exist. What's your mobile platform? |
But on the other hand, what if system is not going to sleep? Would this increase battery consumption while system is awake? |
Setting it to 28 minutes as default should alleviate he problem. |
Why 28 minutes? |
It is the timeout for GMS heartbeat on mobile network. |
ref #490
TCP Keep Alive is useful for purging dead connections. Since many users run shadowsocks with mobile connection, there should be higher chance to leave dead connections on servers.
Further more, Go already have set 15 seconds keep alive timeout on all TCP connections. (Go's source code can prove that: net/tcpsock_posix.go:accept. And here is the issue golang/go#31510 that introduced this feature into the standard
net
library.)SO_KEEPALIVE
is not enabled by default for most operating systems.Introducing this feature shouldn't break anything. If you have encountered anything related to this, please comment.
Adding a new configuration field for customizing the keep alive timeout
The text was updated successfully, but these errors were encountered: