summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2020-10-28 17:18:33 -0700
committerGravatar bunnei2020-10-28 17:19:12 -0700
commit156556ddd2128e8e9a73a7166985639228015bcf (patch)
tree00dfd9e9aa7ab449664202a8a1ed9e988cd9ceaf /src
parentMerge pull request #4855 from bunnei/cdma-pusher-log-fix (diff)
downloadyuzu-156556ddd2128e8e9a73a7166985639228015bcf.tar.gz
yuzu-156556ddd2128e8e9a73a7166985639228015bcf.tar.xz
yuzu-156556ddd2128e8e9a73a7166985639228015bcf.zip
web_service: web_backend: Handle socket errors with GenericRequest.
- Fixes a shutdown crash when we try to submit telemetry if there is a service issue.
Diffstat (limited to 'src')
-rw-r--r--src/web_service/web_backend.cpp11
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 {
65 if (cli == nullptr) { 65 if (cli == nullptr) {
66 cli = std::make_unique<httplib::Client>(host.c_str()); 66 cli = std::make_unique<httplib::Client>(host.c_str());
67 } 67 }
68
69 if (!cli->is_valid()) {
70 LOG_ERROR(WebService, "Client is invalid, skipping request!");
71 return {};
72 }
73
74 if (!cli->is_socket_open()) {
75 LOG_ERROR(WebService, "Failed to open socket, skipping request!");
76 return {};
77 }
78
68 cli->set_connection_timeout(TIMEOUT_SECONDS); 79 cli->set_connection_timeout(TIMEOUT_SECONDS);
69 cli->set_read_timeout(TIMEOUT_SECONDS); 80 cli->set_read_timeout(TIMEOUT_SECONDS);
70 cli->set_write_timeout(TIMEOUT_SECONDS); 81 cli->set_write_timeout(TIMEOUT_SECONDS);