diff options
-rw-r--r-- | etc/inc/openvpn.inc | 14 | ||||
-rw-r--r-- | usr/local/www/status_openvpn.php | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 9053c85..f7765b1 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -752,6 +752,10 @@ function openvpn_get_active_servers() { /* read the next line */ $line = fgets($fp, 1024); + $info = stream_get_meta_data($fp); + if ($info['timed_out']) + break; + /* parse header list line */ if (strstr($line, "HEADER")) continue; @@ -830,7 +834,11 @@ function openvpn_get_active_clients() { while (!feof($fp)) { /* read the next line */ $line = fgets($fp, 1024); - + + $info = stream_get_meta_data($fp); + if ($info['timed_out']) + break; + /* Get the client state */ if (strstr($line,"CONNECTED")) { $client['status']="up"; @@ -853,6 +861,10 @@ function openvpn_get_active_clients() { /* read the next line */ $line = fgets($fp, 1024); + $info = stream_get_meta_data($fp); + if ($info['timed_out']) + break; + if (strstr($line,"TCP/UDP read bytes")) { $list = explode(",", $line); $client['bytes_recv'] = $list[1]; diff --git a/usr/local/www/status_openvpn.php b/usr/local/www/status_openvpn.php index 9240825..683db69 100644 --- a/usr/local/www/status_openvpn.php +++ b/usr/local/www/status_openvpn.php @@ -79,6 +79,11 @@ function kill_client($port, $remipp) { fputs($fp, "kill {$remipp}\n"); while (!feof($fp)) { $line = fgets($fp, 1024); + + $info = stream_get_meta_data($fp); + if ($info['timed_out']) + break; + /* parse header list line */ if (strpos($line, "INFO:")) continue; |