From 56c45fc5c1bb1843aebc2163700b120c5bb984fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 5 Mar 2021 13:38:05 +0800 Subject: [PATCH] Reduce max accounts to 16 --- .github/workflows/debug.yml | 12 ++--- .github/workflows/release.yml | 12 ++--- .../jni/tgnet/ConnectionsManager.cpp | 50 +------------------ TMessagesProj/jni/tgnet/Defines.h | 2 +- .../org/telegram/messenger/UserConfig.java | 2 +- bin/libs/native.sh | 2 +- run | 9 ++-- 7 files changed, 22 insertions(+), 67 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index e3c8643b3..79eecf8a6 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -14,7 +14,7 @@ on: jobs: ffmpeg: - name: Native Build ( FFmpeg ) + name: Native Build (FFmpeg) runs-on: ubuntu-latest steps: - name: Checkout @@ -42,7 +42,7 @@ jobs: run: | ./run init libs ffmpeg boringssl: - name: Native Build ( BoringSSL ) + name: Native Build (BoringSSL) runs-on: ubuntu-latest steps: - name: Checkout @@ -71,7 +71,7 @@ jobs: ./run init action boringssl ./run init libs boringssl native: - name: Native Build ( Telegram ) + name: Native Build (Telegram) runs-on: ubuntu-latest needs: - ffmpeg @@ -127,7 +127,7 @@ jobs: run: | ./run libs native v2ray: - name: Native Build ( V2ray ) + name: Native Build (V2ray) runs-on: ubuntu-latest steps: - name: Checkout @@ -157,7 +157,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: ./run libs v2ray shadowsocks: - name: Native Build ( Shadowsocks ) + name: Native Build (Shadowsocks) runs-on: ubuntu-latest steps: - name: Checkout @@ -187,7 +187,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: ./run libs shadowsocks shadowsocksr: - name: Native Build ( ShadowsocksR ) + name: Native Build (ShadowsocksR) runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 866171638..c0500961d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ffmpeg: - name: Native Build ( FFmpeg ) + name: Native Build (FFmpeg) runs-on: ubuntu-latest needs: check steps: @@ -55,7 +55,7 @@ jobs: run: | ./run init libs ffmpeg boringssl: - name: Native Build ( BoringSSL ) + name: Native Build (BoringSSL) runs-on: ubuntu-latest needs: check steps: @@ -85,7 +85,7 @@ jobs: ./run init action boringssl ./run init libs boringssl native: - name: Native Build ( Telegram ) + name: Native Build (Telegram) runs-on: ubuntu-latest needs: - ffmpeg @@ -141,7 +141,7 @@ jobs: run: | ./run libs native v2ray: - name: Native Build ( V2ray ) + name: Native Build (V2ray) runs-on: ubuntu-latest needs: check steps: @@ -172,7 +172,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: ./run libs v2ray shadowsocks: - name: Native Build ( Shadowsocks ) + name: Native Build (Shadowsocks) runs-on: ubuntu-latest needs: check steps: @@ -203,7 +203,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: ./run libs shadowsocks shadowsocksr: - name: Native Build ( ShadowsocksR ) + name: Native Build (ShadowsocksR) runs-on: ubuntu-latest needs: check steps: diff --git a/TMessagesProj/jni/tgnet/ConnectionsManager.cpp b/TMessagesProj/jni/tgnet/ConnectionsManager.cpp index d6818f3f7..eb9d2f5fc 100644 --- a/TMessagesProj/jni/tgnet/ConnectionsManager.cpp +++ b/TMessagesProj/jni/tgnet/ConnectionsManager.cpp @@ -180,57 +180,9 @@ ConnectionsManager& ConnectionsManager::getInstance(int32_t instanceNum) { static ConnectionsManager instance14(14); return instance14; case 15: + default: static ConnectionsManager instance15(15); return instance15; - case 16: - static ConnectionsManager instance16(16); - return instance16; - case 17: - static ConnectionsManager instance17(17); - return instance17; - case 18: - static ConnectionsManager instance18(18); - return instance18; - case 19: - static ConnectionsManager instance19(19); - return instance19; - case 20: - static ConnectionsManager instance20(20); - return instance20; - case 21: - static ConnectionsManager instance21(21); - return instance21; - case 22: - static ConnectionsManager instance22(22); - return instance22; - case 23: - static ConnectionsManager instance23(23); - return instance23; - case 24: - static ConnectionsManager instance24(24); - return instance24; - case 25: - static ConnectionsManager instance25(25); - return instance25; - case 26: - static ConnectionsManager instance26(26); - return instance26; - case 27: - static ConnectionsManager instance27(27); - return instance27; - case 28: - static ConnectionsManager instance28(28); - return instance28; - case 29: - static ConnectionsManager instance29(29); - return instance29; - case 30: - static ConnectionsManager instance30(30); - return instance30; - case 31: - default: - static ConnectionsManager instance31(31); - return instance31; } } diff --git a/TMessagesProj/jni/tgnet/Defines.h b/TMessagesProj/jni/tgnet/Defines.h index 38656e4df..6069eb4cf 100644 --- a/TMessagesProj/jni/tgnet/Defines.h +++ b/TMessagesProj/jni/tgnet/Defines.h @@ -28,7 +28,7 @@ #define DOWNLOAD_CONNECTIONS_COUNT 2 #define UPLOAD_CONNECTIONS_COUNT 4 #define CONNECTION_BACKGROUND_KEEP_TIME 10000 -#define MAX_ACCOUNT_COUNT 32 +#define MAX_ACCOUNT_COUNT 16 #define USE_DELEGATE_HOST_RESOLVE #define USE_IPV4_ONLY 0 diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java index 0d64d8653..28b2ae031 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java @@ -23,7 +23,7 @@ import java.util.Arrays; public class UserConfig extends BaseController { public static int selectedAccount; - public final static int MAX_ACCOUNT_COUNT = 32; + public final static int MAX_ACCOUNT_COUNT = 16; private final Object sync = new Object(); private boolean configLoaded; diff --git a/bin/libs/native.sh b/bin/libs/native.sh index 4ddf2646e..600ed1bf7 100755 --- a/bin/libs/native.sh +++ b/bin/libs/native.sh @@ -4,7 +4,7 @@ source "bin/init/env.sh" ./gradlew TMessagesProj:stripFullFossDebugSymbols || exit 1 -OUT=TMessagesProj/build/intermediates/stripped_native_libs/fullFossRelease/out/lib +OUT=TMessagesProj/build/intermediates/stripped_native_libs/fullFoss/out/lib DIR=TMessagesProj/src/main/libs rm -rf $DIR/armeabi-v7a mkdir -p $DIR/armeabi-v7a diff --git a/run b/run index fc95b2d6c..df596d7de 100755 --- a/run +++ b/run @@ -1,11 +1,14 @@ #!/bin/bash +EXEC="" TARGET="bin" for e in $@; do TARGET="$TARGET/$e" shift if [ -x "${TARGET}.sh" ]; then - echo ">> ${TARGET}.sh" - exec "${TARGET}.sh" $@ + EXEC="${TARGET}.sh" fi -done \ No newline at end of file +done + +echo ">> $EXEC" +exec "$EXEC" $@ \ No newline at end of file