1
0

Update HTTPSClientPool.cpp

This commit is contained in:
Emagi 2024-12-06 09:16:25 -05:00
parent f0b37e67d1
commit 2769d97bfe

View File

@ -545,24 +545,22 @@ void HTTPSClientPool::pollPeerHealth(const std::string& server, const std::strin
std::string worldAddr(""), internalWorldAddr(""), clientIP(""); std::string worldAddr(""), internalWorldAddr(""), clientIP("");
int16 worldPort = 0; int16 worldPort = 0;
try { try {
auto webStatusTree = json_tree.get_child("WebStatus"); if (auto status = json_tree.get_optional<std::string>("world_status")) {
if (auto status = webStatusTree.get_optional<std::string>("world_status")) {
online_status = status.get(); online_status = status.get();
} }
if (auto priority = webStatusTree.get_optional<int16>("peer_priority")) { if (auto priority = json_tree.get_optional<int16>("peer_priority")) {
peer_priority = priority.get(); peer_priority = priority.get();
} }
if (auto isprimary = webStatusTree.get_optional<bool>("peer_primary")) { if (auto isprimary = json_tree.get_optional<bool>("peer_primary")) {
peer_primary = isprimary.get(); peer_primary = isprimary.get();
} }
if (auto peerclientaddr = webStatusTree.get_optional<std::string>("peer_client_address")) { if (auto peerclientaddr = json_tree.get_optional<std::string>("peer_client_address")) {
worldAddr = peerclientaddr.get(); worldAddr = peerclientaddr.get();
} }
if (auto peerclient_internaladdr = webStatusTree.get_optional<std::string>("peer_client_internal_address")) { if (auto peerclient_internaladdr = json_tree.get_optional<std::string>("peer_client_internal_address")) {
internalWorldAddr = peerclient_internaladdr.get(); internalWorldAddr = peerclient_internaladdr.get();
} }
if (auto peerclientport = webStatusTree.get_optional<int16>("peer_client_port")) { if (auto peerclientport = json_tree.get_optional<int16>("peer_client_port")) {
worldPort = peerclientport.get(); worldPort = peerclientport.get();
} }
if(worldAddr.size() > 0 && worldPort > 0) { if(worldAddr.size() > 0 && worldPort > 0) {