From 39c8d18feba8eafcd43fbb55e73ae150a1947aad Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Oct 2020 08:10:50 -0400 Subject: core/CMakeLists: Make some warnings errors Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors. --- src/core/hle/service/bcat/backend/boxcat.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/core/hle/service/bcat/backend/boxcat.cpp') diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index ca021a99f..589e288df 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -196,7 +196,9 @@ private: const std::string& content_type_name) { if (client == nullptr) { client = std::make_unique(BOXCAT_HOSTNAME, PORT); - client->set_timeout_sec(timeout_seconds); + client->set_connection_timeout(timeout_seconds); + client->set_read_timeout(timeout_seconds); + client->set_write_timeout(timeout_seconds); } httplib::Headers headers{ @@ -255,7 +257,7 @@ private: return out; } - std::unique_ptr client; + std::unique_ptr client; std::string path; u64 title_id; u64 build_id; @@ -443,7 +445,9 @@ std::optional> Boxcat::GetLaunchParameter(TitleIDVersion title) Boxcat::StatusResult Boxcat::GetStatus(std::optional& global, std::map& games) { httplib::SSLClient client{BOXCAT_HOSTNAME, static_cast(PORT)}; - client.set_timeout_sec(static_cast(TIMEOUT_SECONDS)); + client.set_connection_timeout(static_cast(TIMEOUT_SECONDS)); + client.set_read_timeout(static_cast(TIMEOUT_SECONDS)); + client.set_write_timeout(static_cast(TIMEOUT_SECONDS)); httplib::Headers headers{ {std::string("Game-Assets-API-Version"), std::string(BOXCAT_API_VERSION)}, -- cgit v1.2.3 From 363c644730198338140d9611b575ff22e14e1287 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 15 Oct 2020 20:58:18 -0700 Subject: service: bcat: Check client connection before interacting with socket. - Fixes a crash when BCAT service is offline. --- src/core/hle/service/bcat/backend/boxcat.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/core/hle/service/bcat/backend/boxcat.cpp') diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 589e288df..3b6f7498e 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -454,6 +454,16 @@ Boxcat::StatusResult Boxcat::GetStatus(std::optional& global, {std::string("Boxcat-Client-Type"), std::string(BOXCAT_CLIENT_TYPE)}, }; + if (!client.is_valid()) { + LOG_ERROR(Service_BCAT, "Client is invalid, going offline!"); + return StatusResult::Offline; + } + + if (!client.is_socket_open()) { + LOG_ERROR(Service_BCAT, "Failed to open socket, going offline!"); + return StatusResult::Offline; + } + const auto response = client.Get(BOXCAT_PATHNAME_EVENTS, headers); if (response == nullptr) return StatusResult::Offline; -- cgit v1.2.3 From be1954e04cb5a0c3a526f78ed5490a5e65310280 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Oct 2020 14:49:45 -0400 Subject: core: Fix clang build Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795 --- src/core/hle/service/bcat/backend/boxcat.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/core/hle/service/bcat/backend/boxcat.cpp') diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 589e288df..bd7ea75c2 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -3,7 +3,16 @@ // Refer to the license.txt file included. #include + +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +#endif #include +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + #include #include #include "common/hex_util.h" -- cgit v1.2.3 From 3d592972dc3fd61cc88771b889eff237e4e03e0f Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 20 Oct 2020 19:07:39 -0700 Subject: Revert "core: Fix clang build" --- src/core/hle/service/bcat/backend/boxcat.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/core/hle/service/bcat/backend/boxcat.cpp') diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index e6cadf491..3b6f7498e 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -3,16 +3,7 @@ // Refer to the license.txt file included. #include - -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#endif #include -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif - #include #include #include "common/hex_util.h" -- cgit v1.2.3 From 5cb1a343d19dc4f1aacfc5075815056c2f09ae8c Mon Sep 17 00:00:00 2001 From: comex Date: Mon, 31 Aug 2020 11:00:39 -0400 Subject: boxcat: Avoid unnecessary object copy --- src/core/hle/service/bcat/backend/boxcat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/service/bcat/backend/boxcat.cpp') diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 3b6f7498e..e43f3f47f 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -483,7 +483,7 @@ Boxcat::StatusResult Boxcat::GetStatus(std::optional& global, global = json["global"].get(); if (json["games"].is_array()) { - for (const auto object : json["games"]) { + for (const auto& object : json["games"]) { if (object.is_object() && object.find("name") != object.end()) { EventStatus detail{}; if (object["header"].is_string()) { -- cgit v1.2.3