File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -51,21 +51,23 @@ function run(){
5151 function checkService ($ service , $ try = 1 ){
5252 list ($ ip , $ port ) = explode (': ' , $ service );
5353 $ this ->config ['results ' ][$ service ] = array ();
54- $ this -> config [ ' results ' ][ $ service ][ ' result ' ] = @fsockopen (
54+ $ fp = @fsockopen (
5555 $ ip ,
5656 $ port ,
5757 $ this ->config ['results ' ][$ service ]['errno ' ],
5858 $ this ->config ['results ' ][$ service ]['errstr ' ],
5959 $ this ->config ['timeout ' ]
6060 );
61- if (!$ this ->config ['results ' ][$ service ]['result ' ]){
61+ if ($ fp ){
62+ @fclose ($ fp );
63+ }else {
6264 $ this ->error ("$ service is down ( $ try/ {$ this ->config ['try ' ]}) " );
6365 if ($ try < $ this ->config ['try ' ]){
6466 sleep ($ this ->config ['timeout ' ]);
6567 return $ this ->checkService ($ service , $ try + 1 );
6668 }
6769 }
68- return $ this ->config ['results ' ][$ service ]['result ' ];
70+ return $ this ->config ['results ' ][$ service ]['result ' ] = $ fp ;
6971 }
7072
7173 /**
You can’t perform that action at this time.
0 commit comments