(configd, mvc) add connect timeout, closes https://github.com/opnsense/core/issues/913

This commit is contained in:
Ad Schellevis 2016-04-27 12:04:31 +02:00
parent 1d0ae14682
commit 307d9238f5

View File

@ -70,16 +70,17 @@ class Backend
* @param string $event event string
* @param bool $detach detach process
* @param int $timeout timeout in seconds
* @param int $connect_timeout connect timeout in seconds
* @return string
* @throws \Exception
*/
public function configdRun($event, $detach = false, $timeout = 120)
public function configdRun($event, $detach = false, $timeout = 120, $connect_timeout = 10)
{
$endOfStream = chr(0).chr(0).chr(0);
$poll_timeout = 2 ; // poll timeout interval
// wait until socket exist for a maximum of $timeout
$timeout_wait = $timeout;
// wait until socket exist for a maximum of $connect_timeout
$timeout_wait = $connect_timeout;
while (!file_exists($this->configdSocket)) {
sleep(1);
$timeout_wait -= 1;