Skip to content

Commit

Permalink
修复BUG
Browse files Browse the repository at this point in the history
修复某些不太可能触发的bug
  • Loading branch information
badafans committed Jun 2, 2022
1 parent 9159ae5 commit fe27c23
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
7 changes: 4 additions & 3 deletions batch/CF优选IP-ANSI.bat
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ mkdir rtt
for /f "tokens=2 delims=:" %%i in ('find /c /v "" ip.txt') do (
set /a ipnum=%%i
)
if !tasknum! GTR !ipnum! set /a tasknum=ipnum
set /a iplist=ipnum/tasknum
if !tasknum! GTR !ipnum! set /a iplist=1
set /a doubletasknum=tasknum*2
if !ipnum! LSS !doubletasknum! (set /a iplist=2) else (set /a iplist=ipnum/tasknum)
set /a a=1
set /a b=1
for /f "delims=" %%i in (ip.txt) do (
Expand All @@ -165,7 +166,7 @@ title RTT
goto rtttest

:rtttest
if !a! NEQ !b! (start /b RTT.bat !a!>nul&set /a a=a+1&goto rtttest) else (goto rttstatus)
if !a! NEQ !b! (start /b rtt.bat !a!>nul&set /a a=a+1&goto rtttest) else (goto rttstatus)

:rttstatus
timeout /T 2 /NOBREAK>nul
Expand Down
7 changes: 4 additions & 3 deletions batch/CF优选IP-UTF8.bat
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ mkdir rtt
for /f "tokens=2 delims=:" %%i in ('find /c /v "" ip.txt') do (
set /a ipnum=%%i
)
if !tasknum! GTR !ipnum! set /a tasknum=ipnum
set /a iplist=ipnum/tasknum
if !tasknum! GTR !ipnum! set /a iplist=1
set /a doubletasknum=tasknum*2
if !ipnum! LSS !doubletasknum! (set /a iplist=2) else (set /a iplist=ipnum/tasknum)
set /a a=1
set /a b=1
for /f "delims=" %%i in (ip.txt) do (
Expand All @@ -165,7 +166,7 @@ title RTT测试中
goto rtttest

:rtttest
if !a! NEQ !b! (start /b RTT.bat !a!>nul&set /a a=a+1&goto rtttest) else (goto rttstatus)
if !a! NEQ !b! (start /b rtt.bat !a!>nul&set /a a=a+1&goto rtttest) else (goto rttstatus)

:rttstatus
timeout /T 2 /NOBREAK>nul
Expand Down
16 changes: 13 additions & 3 deletions shell/cf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,21 @@ do
fi
rm -rf meta.txt data.txt
ipnum=$(cat anycast.txt | wc -l)
if [ $tasknum == 0 ]
then
tasknum=1
fi
if [ $ipnum -lt $tasknum ]
then
tasknum=ipnum
iplist=1
fi
doubletasknum=$[$tasknum*2]
if [ $ipnum -lt $doubletasknum ]
then
iplist=2
else
iplist=ipnum/tasknum
fi
iplist=ipnum/tasknum
declare -i a=1
declare -i b=1
for i in `cat anycast.txt`
Expand Down Expand Up @@ -261,7 +271,7 @@ do
while true
do
sleep 2
n=$(ls rtt | grep txt | grep -v "grep" | wc -l)
n=$(ls rtt | grep txt | wc -l)
if [ $n -ne 0 ]
then
echo $(date +'%H:%M:%S') 等待RTT测试结束,剩余进程数 $n
Expand Down

0 comments on commit fe27c23

Please sign in to comment.