Make all places returning std::async [[nodiscard]]

This commit is contained in:
Tulio Leao authored and Gymnasiast committed 2026-08-20 20:35:45 +02:00
1 parent 4cce29b5a9
commit 44b178e30f
2 files changed
+6 -4

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ namespace OpenRCT2::Http
Response Do(const Request& req);
inline auto DoAsync(const Request& req, std::function<void(Response& res)> fn)
[[nodiscard]] inline auto DoAsync(const Request& req, std::function<void(Response& res)> fn)
{
return std::async(std::launch::async, [=]() {
Response res{};
+5 -3
View File
@@ -264,7 +264,7 @@ namespace OpenRCT2::Network
}
}
std::future<std::vector<ServerListEntry>> ServerList::FetchLocalServerListAsync(
[[nodiscard]] std::future<std::vector<ServerListEntry>> ServerList::FetchLocalServerListAsync(
const INetworkEndpoint& broadcastEndpoint) const
{
auto broadcastAddress = broadcastEndpoint.GetHostname();
@@ -321,7 +321,7 @@ namespace OpenRCT2::Network
});
}
std::future<std::vector<ServerListEntry>> ServerList::FetchLocalServerListAsync() const
[[nodiscard]] std::future<std::vector<ServerListEntry>> ServerList::FetchLocalServerListAsync() const
{
return std::async(std::launch::async, [&] {
// Get all possible LAN broadcast addresses
@@ -372,7 +372,9 @@ namespace OpenRCT2::Network
request.url = std::move(masterServerUrl);
request.method = Http::Method::get;
request.header["Accept"] = "application/json";
Http::DoAsync(request, [p](Http::Response& response) -> void {
// Despite DoAsync, the future below is not stored, so it will block the calling thread until the request completes
// TOOD: Review if this is acceptable
std::ignore = Http::DoAsync(request, [p](Http::Response& response) -> void {
json_t root;
try
{