Browse Source

luci-app-ssr-plus: enable multiple threads for naiveproxy

CN_SZTL 5 years ago
parent
commit
f5d56f49d5
2 changed files with 5 additions and 4 deletions
  1. 1 1
      luci-app-ssr-plus/Makefile
  2. 4 3
      luci-app-ssr-plus/root/etc/init.d/shadowsocksr

+ 1 - 1
luci-app-ssr-plus/Makefile

@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-ssr-plus
 PKG_VERSION:=180
-PKG_RELEASE:=8
+PKG_RELEASE:=9
 
 include $(INCLUDE_DIR)/package.mk
 

+ 4 - 3
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -204,7 +204,8 @@ gen_config_file() {
 		cat <<-EOF >/var/etc/naive-ssr-$FILE_NAME.json
 			{
 			"listen": "$PROTO://0.0.0.0:$3",
-			"proxy": "https://$(uci_get_by_name $1 username):$(uci_get_by_name $1 password)@$(uci_get_by_name $1 server):$(uci_get_by_name $1 server_port)"
+			"proxy": "https://$(uci_get_by_name $1 username):$(uci_get_by_name $1 password)@$(uci_get_by_name $1 server):$(uci_get_by_name $1 server_port)",
+			"concurrency": "${4:-1}"
 			}
 		EOF
 		;;
@@ -342,12 +343,12 @@ start_redir_tcp() {
 		-l :$server_port $password $kcp_param
 		kcp_enable_flag=1
 	fi
-	gen_config_file $GLOBAL_SERVER 0 $(uci_get_by_name $GLOBAL_SERVER local_port 1234)
 	if [ "$(uci_get_by_type global threads 0)" == "0" ]; then
 		threads=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
 	else
 		threads=$(uci_get_by_type global threads)
 	fi
+	gen_config_file $GLOBAL_SERVER 0 $(uci_get_by_name $GLOBAL_SERVER local_port 1234) $threads
 	case "$type" in
 	ss | ssr)
 		local last_config_file=$CONFIG_FILE
@@ -370,7 +371,7 @@ start_redir_tcp() {
 		;;
 	naiveproxy)
 		$bin /var/etc/naive-ssr-retcp.json >/dev/null 2>&1 &
-		echo "$(date "+%Y-%m-%d %H:%M:%S") Main node:$($bin --version 2>&1 | head -1) Started!" >>/tmp/ssrplus.log
+		echo "$(date "+%Y-%m-%d %H:%M:%S") Main node:$($bin --version 2>&1 | head -1) , $threads Threads Started!" >>/tmp/ssrplus.log
 		;;
 	socks5)
 		/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-retcp.conf" socks5 tcp $(uci_get_by_name $GLOBAL_SERVER local_port) \