Browse Source

Use the return code as a judgment

Mattraks 5 years ago
parent
commit
7a880c5b7f
2 changed files with 3 additions and 4 deletions
  1. 1 1
      luci-app-ssr-plus/Makefile
  2. 2 3
      luci-app-ssr-plus/root/usr/bin/ssr-switch

+ 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:=3
+PKG_RELEASE:=5
 
 include $(INCLUDE_DIR)/package.mk
 

+ 2 - 3
luci-app-ssr-plus/root/usr/bin/ssr-switch

@@ -81,9 +81,8 @@ test_proxy() {
 	local serverport=$(uci_get_by_name $1 server_port)
 	ipset add ss_spec_wan_ac $servername 2>/dev/null
 	ret1=$?
-	ret=$(tcping -q -c 3 -i 1 -t 2 -p $serverport $servername)
-	#echo "$(date "+%Y-%m-%d %H:%M:%S") test_proxy> name: $servername, ret1: $ret1, ret: $ret" >> /tmp/ssrplus.log
-	if [ "$ret" -gt "0" ]; then
+	tcping -q -c 3 -i 1 -t 2 -p $serverport $servername
+	if [ "$?" -gt "0" ]; then
 		[ "$ret1" == "0" ] && ipset del ss_spec_wan_ac $servername 2>/dev/null
 		return 1
 	fi