Skip to content

Commit a6260d3

Browse files
committed
Fix Bugs and Add Support for all algorithms
1. Fix Installation related bugs. 2. Add support for all algorithms supported by kernel.
1 parent 43a3e52 commit a6260d3

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

module/customize.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ create_file_if_needed() {
4343
# Find any file starting with ${prefix}_ in MODULEPATH and copy it to MODPATH
4444
source_file=$(find "$MODULE_PATH" -name "${prefix}_*" -print -quit)
4545
if [ -n "$source_file" ]; then
46-
cp "$source_file" "$target"
47-
ui_print " [+] Copied from MODULE_PATH to MODPATH: $target"
46+
cp "$source_file" "$MODPATH/"
47+
48+
file_name=$(basename "$source_file")
49+
ui_print " [+] Copied from $MODULE_PATH to $MODPATH: $file_name"
4850
fi
4951
else
5052
ui_print " [-] Skipping $target: file already exists."
@@ -69,3 +71,17 @@ fi
6971

7072
# Always create rmnet_data_cubic unless another exists
7173
create_file_if_needed "rmnet_data" "cubic"
74+
75+
if check_exists_anywhere "kill"; then
76+
# If file exists and KSU is true, copy any file from MODULEPATH with the same prefix
77+
if [ "$KSU" = true ]; then
78+
# Find any file starting with ${prefix}_ in MODULEPATH and copy it to MODPATH
79+
source_file=$(find "$MODULE_PATH" -name "kill_connections" -print -quit)
80+
if [ -n "$source_file" ]; then
81+
cp "$source_file" "$MODPATH/"
82+
ui_print " [+] Copied from $MODULE_PATH to $MODPATH: kill_connections"
83+
fi
84+
else
85+
ui_print " [-] Skipping $MODPATH/kill_connections: file already exists."
86+
fi
87+
fi

module/service.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ FLAGFILE="/dev/.tcp_module_log_cleared"
66
MAX_LOG_LINES=200
77
DEBOUNCE_TIME=10
88

9+
# Get the list of available congestion control algorithms
10+
congestion_algorithms=$(cat /proc/sys/net/ipv4/tcp_available_congestion_control)
11+
912
# Clear log on first run after boot
1013
if [ ! -f "$FLAGFILE" ]; then
1114
rm -f "$LOGFILE" >/dev/null 2>&1
@@ -103,7 +106,7 @@ while true; do
103106
if [ "$((current_time - change_time))" -ge "$DEBOUNCE_TIME" ]; then
104107
applied=0
105108
if [ "$new_mode" = "Wi-Fi" ]; then
106-
for algo in bbr reno cubic; do
109+
for algo in $congestion_algorithms; do
107110
if [ -f "$MODPATH/wlan_$algo" ]; then
108111
set_congestion "$algo" "$new_mode"
109112
applied=1
@@ -112,7 +115,7 @@ while true; do
112115
done
113116
[ "$applied" -eq 0 ] && set_congestion cubic "$new_mode"
114117
elif [ "$new_mode" = "Cellular" ]; then
115-
for algo in bbr reno cubic; do
118+
for algo in $congestion_algorithms; do
116119
if [ -f "$MODPATH/rmnet_data_$algo" ]; then
117120
set_congestion "$algo" "$new_mode"
118121
applied=1

0 commit comments

Comments
 (0)