diff options
Diffstat (limited to '')
-rw-r--r-- | src/web_service/web_backend.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index c56cd7c71..f264b98a0 100644 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp @@ -65,6 +65,17 @@ struct Client::Impl { if (cli == nullptr) { 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_read_timeout(TIMEOUT_SECONDS); cli->set_write_timeout(TIMEOUT_SECONDS); |