Add support for "optimize tcp buffers" option per profile. #3137
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It tunes down the local sslocal listener socket buffers which is the right thing to do in 99.999% of cases of mobile app.
It additionally also tunes down the remote socket buffers of sslocal when a plugin is used. This is needed to ensure there's no bufferbloat between sslocal and the plugin itself.
Ideally the plugin on its side should also choke its local listening socket buffers and leave only its remote side socket buffers unrestricted.
An additional follow up fix is needed which is to use a version of shadowsocks-rust which implements the buffer controls on the listening socket side. I have opened a PR there: Set the incoming socket buffer sizes properly on the listen socket. shadowsocks-rust#1381
Given that ss-android is using an older release of ss-rust. The PR will probably need to be backported to 1.5.x branch, or ss-android needs to upgrade to latest ss-rust after my PR is merged and a release is made.
This fixes the following issue which happens when using shadowsocks with or without a plugin:
Large file uploads immediately jump to 80-90% and hang because the unrestricted local socket of ss, copies most or the file inside it giving a premature acknowledgement to the app, then the app hangs while the actual proxy uploads the file bit by bit (this issue is highly apparent on slow upload internet condition). Most apps will consider this hang as a timeout and fail to upload.
This issue affects for example Whatsapp Google Drive backup which fails to upload while shadowsocks is working when the backup size becomes big enough. It also causes failures to google drive sync.
I added translation for all languages by carefully finessing google bard and translating back and forth multiple times until both sides give the same result, feel free to improve them.