mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 10:35:27 +00:00
wait for configd socket if it's not there yet (https://github.com/opnsense/core/issues/218)
This commit is contained in:
parent
4ac49f5621
commit
b282f65db5
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user