diff options
author | Ermal <eri@pfsense.org> | 2010-08-18 15:57:20 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-08-18 15:57:20 +0000 |
commit | b01406759249bee22fd81b0258338473df18601a (patch) | |
tree | 764edb0604df3c3e0cad38ffffcf16cb3ae55c5b | |
parent | 71ca2cb2d4c2f573939db6801bef3db59d3b8b3c (diff) | |
download | pfsense-b01406759249bee22fd81b0258338473df18601a.zip pfsense-b01406759249bee22fd81b0258338473df18601a.tar.gz |
Ticket #826. Add more bandage to notice when a reading on socket timeouts.
-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; |