mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 14:52:45 +01:00
Merge pull request #4856 from bunnei/webservice-socket-error
web_service: web_backend: Handle socket errors with GenericRequest.
This commit is contained in:
commit
c20569ebdf
1 changed files with 11 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue