mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Master server query code improvements
* Improved error messages. * Fixed bug where status was not checked to determine what error message to return.
This commit is contained in:
parent
b965e04dd4
commit
8b227c90d8
@ -78,7 +78,7 @@ vector<NetGameServer_t> CPylon::GetServerList(string& svOutMessage) const
|
||||
}
|
||||
else
|
||||
{
|
||||
svOutMessage = string("Unknown error with status: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Unknown error with status: {:d}", status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,17 +96,17 @@ vector<NetGameServer_t> CPylon::GetServerList(string& svOutMessage) const
|
||||
}
|
||||
else
|
||||
{
|
||||
svOutMessage = string("Failed HTTP request: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Server list error: {:d}", status);
|
||||
}
|
||||
|
||||
return vslList;
|
||||
}
|
||||
|
||||
svOutMessage = string("Failed HTTP request: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Failed comp-server query: {:d}", status);
|
||||
return vslList;
|
||||
}
|
||||
|
||||
svOutMessage = "Failed to reach comp-server: connection timed-out";
|
||||
svOutMessage = fmt::format("Failed to reach comp-server: {:s}", "connection timed-out");
|
||||
return vslList;
|
||||
}
|
||||
}
|
||||
@ -198,15 +198,16 @@ bool CPylon::GetServerByToken(NetGameServer_t& slOutServer, string& svOutMessage
|
||||
}
|
||||
else
|
||||
{
|
||||
svOutMessage = string("Unknown error with status: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Unknown error with status: {:d}", status);
|
||||
}
|
||||
|
||||
slOutServer = NetGameServer_t{};
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status)
|
||||
{
|
||||
if (!svResponseBuf.empty())
|
||||
{
|
||||
@ -218,17 +219,17 @@ bool CPylon::GetServerByToken(NetGameServer_t& slOutServer, string& svOutMessage
|
||||
}
|
||||
else
|
||||
{
|
||||
svOutMessage = string("Server not found: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Server not found: {:d}", status);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
svOutMessage = string("Failed HTTP request: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Failed comp-server query: {:d}", status);
|
||||
return false;
|
||||
}
|
||||
|
||||
svOutMessage = "Failed to reach comp-server: connection timed-out";
|
||||
slOutServer = NetGameServer_t{};
|
||||
svOutMessage = fmt::format("Failed to reach comp-server: {:s}", "connection timed-out");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -309,7 +310,8 @@ bool CPylon::PostServerHost(string& svOutMessage, string& svOutToken, const NetG
|
||||
}
|
||||
else
|
||||
{
|
||||
svOutToken = string();
|
||||
svOutMessage = fmt::format("Invalid response with status: {:d}", status);
|
||||
svOutToken.clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -322,12 +324,14 @@ bool CPylon::PostServerHost(string& svOutMessage, string& svOutToken, const NetG
|
||||
}
|
||||
else
|
||||
{
|
||||
svOutMessage = string("Unknown error with status: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Unknown error with status: {:d}", status);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status)
|
||||
{
|
||||
if (!svResponseBuf.empty())
|
||||
{
|
||||
@ -339,19 +343,20 @@ bool CPylon::PostServerHost(string& svOutMessage, string& svOutToken, const NetG
|
||||
}
|
||||
else
|
||||
{
|
||||
svOutMessage = string("Failed HTTP request: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Server host error: {:d}", status);
|
||||
}
|
||||
|
||||
svOutToken = string();
|
||||
svOutToken.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
svOutToken = string();
|
||||
svOutMessage = string("Failed HTTP request: ") + std::to_string(status);
|
||||
svOutMessage = fmt::format("Failed comp-server query: {:d}", status);
|
||||
svOutToken.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
svOutToken = string();
|
||||
svOutMessage = "Failed to reach comp-server: connection timed-out";
|
||||
svOutMessage = fmt::format("Failed to reach comp-server: {:s}", "connection timed-out");
|
||||
svOutToken.clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user