Skip to content

Commit

Permalink
feat(net): support dynamic server endpoints using handover
Browse files Browse the repository at this point in the history
  • Loading branch information
PichotM committed Jul 24, 2024
1 parent a75420b commit dae7f7b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion code/components/net/src/NetLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ concurrency::task<void> NetLibrary::ConnectToServer(const std::string& rootUrl)
m_connectionState = CS_IDLE;
return true;
}

auto rawEndpoints = (node.find("endpoints") != node.end()) ? node["endpoints"] : json{};

auto continueAfterEndpoints = [=, capNode = node](const json& capEndpointsJson)
Expand All @@ -1206,6 +1206,14 @@ concurrency::task<void> NetLibrary::ConnectToServer(const std::string& rootUrl)
// gather endpoints
std::vector<std::string> endpoints;

if (!node["handover"].is_null())
{
if (!node["handover"]["endpoints"].is_null())
{
endpointsJson = node["handover"]["endpoints"];
}
}

if (!endpointsJson.is_null() && !endpointsJson.is_boolean())
{
for (const auto& endpoint : endpointsJson)
Expand Down

0 comments on commit dae7f7b

Please sign in to comment.