Project

General

Profile

« Previous | Next » 

Revision 19e3d450

Added by Ermal LUÇI almost 15 years ago

Ticket #826. Add timeout of 1 second for all read/write actions performed on the socket. This should fix point 1) on the ticket.

View differences:

etc/inc/openvpn.inc
733 733
			/* open a tcp connection to the management port of each server */
734 734
			$fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
735 735
			if ($fp) {
736
				stream_set_timeout($fp, 1);
736 737
	
737 738
				/* send our status request */
738 739
				fputs($fp, "status 2\n");
......
809 810
			/* open a tcp connection to the management port of each cli */
810 811
			$fp = @stream_socket_client($tcpcli, $errval, $errstr, 1);
811 812
			if ($fp) {
812
	
813
				stream_set_timeout($fp, 1);
813 814
				/* send our status request */
814 815
				fputs($fp, "state 1\n");
815 816
	
usr/local/www/status_openvpn.php
72 72
	$fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
73 73
	$killed = -1;
74 74
	if ($fp) {
75
		stream_set_timeout($fp, 1);
75 76
		fputs($fp, "kill {$remipp}\n");
76 77
		while (!feof($fp)) {
77 78
			$line = fgets($fp, 1024);

Also available in: Unified diff