-
-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guard socket and FTL response #2164
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the reason for this change, but I have 2 questions:
What is returned to javascript, if PHP founds "FTLnotrunning"
? Nothing?
How does javascript handle this kind of error?
Good question. So far I just return nothing. But I looked and most calls in js are guarded with
So I think a nice solution is to return an array with |
I agree. |
The tests will pass after #2166 has been merged and the branch has been rebased. |
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/pi-hole-ftl-v5-15-web-v5-12-and-core-v5-10-released/54987/1 |
git rebase
)git commit --signoff
)What does this PR aim to accomplish?:
When the FTL socket dies unexpectedly (i.e. by Pi-hole restart) and the web interface is still open,
$data = array("FTLnotrunning" => true);
is send to the calling functions. However, there was no guarding so far for this response, which leads to errors within the calling functions. This PR adds a check for the$data = array("FTLnotrunning" => true);
response and only proceeds the calling function if this data is not present.Additionally, it guards the
fclose($socket);
by checking foris_resource($socket))