Commit b282f65d authored by Ad Schellevis's avatar Ad Schellevis

wait for configd socket if it's not there yet (https://github.com/opnsense/core/issues/218)

parent 4ac49f56
...@@ -61,6 +61,16 @@ class Backend ...@@ -61,6 +61,16 @@ class Backend
$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
$timeout_wait = $timeout;
while (!file_exists($this->configdSocket)) {
sleep(1);
$timeout_wait -= 1;
if ($timeout_wait <= 0) {
throw new \Exception("failed waiting for configd (doesn't seem to be running)");
}
}
$resp = ""; $resp = "";
$stream = stream_socket_client('unix://'.$this->configdSocket, $errorNumber, $errorMessage, $poll_timeout); $stream = stream_socket_client('unix://'.$this->configdSocket, $errorNumber, $errorMessage, $poll_timeout);
if ($stream === false) { if ($stream === false) {
......
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