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

This commit is contained in:
Ad Schellevis 2015-06-22 15:14:22 +02:00
parent 4ac49f5621
commit b282f65db5

View File

@ -61,6 +61,16 @@ class Backend
$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;
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 = "";
$stream = stream_socket_client('unix://'.$this->configdSocket, $errorNumber, $errorMessage, $poll_timeout);
if ($stream === false) {