Commit 307d9238 authored by Ad Schellevis's avatar Ad Schellevis

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

parent 1d0ae146
...@@ -70,16 +70,17 @@ class Backend ...@@ -70,16 +70,17 @@ class Backend
* @param string $event event string * @param string $event event string
* @param bool $detach detach process * @param bool $detach detach process
* @param int $timeout timeout in seconds * @param int $timeout timeout in seconds
* @param int $connect_timeout connect timeout in seconds
* @return string * @return string
* @throws \Exception * @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); $endOfStream = chr(0).chr(0).chr(0);
$poll_timeout = 2 ; // poll timeout interval $poll_timeout = 2 ; // poll timeout interval
// wait until socket exist for a maximum of $timeout // wait until socket exist for a maximum of $connect_timeout
$timeout_wait = $timeout; $timeout_wait = $connect_timeout;
while (!file_exists($this->configdSocket)) { while (!file_exists($this->configdSocket)) {
sleep(1); sleep(1);
$timeout_wait -= 1; $timeout_wait -= 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment