Skip to content
Snippets Groups Projects
Unverified Commit c20569eb authored by LC's avatar LC Committed by GitHub
Browse files

Merge pull request #4856 from bunnei/webservice-socket-error

web_service: web_backend: Handle socket errors with GenericRequest.
parents 475d46bb 156556dd
No related branches found
No related tags found
No related merge requests found
...@@ -65,6 +65,17 @@ struct Client::Impl { ...@@ -65,6 +65,17 @@ struct Client::Impl {
if (cli == nullptr) { if (cli == nullptr) {
cli = std::make_unique<httplib::Client>(host.c_str()); cli = std::make_unique<httplib::Client>(host.c_str());
} }
if (!cli->is_valid()) {
LOG_ERROR(WebService, "Client is invalid, skipping request!");
return {};
}
if (!cli->is_socket_open()) {
LOG_ERROR(WebService, "Failed to open socket, skipping request!");
return {};
}
cli->set_connection_timeout(TIMEOUT_SECONDS); cli->set_connection_timeout(TIMEOUT_SECONDS);
cli->set_read_timeout(TIMEOUT_SECONDS); cli->set_read_timeout(TIMEOUT_SECONDS);
cli->set_write_timeout(TIMEOUT_SECONDS); cli->set_write_timeout(TIMEOUT_SECONDS);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment