mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-05 07:16:18 +00:00
use boost beast instead of curl
This commit is contained in:
@@ -36,8 +36,8 @@ std::string GenerateCall() {
|
||||
<< "&desc=" << ServerDesc;
|
||||
return Ret.str();
|
||||
}
|
||||
std::string RunPromise(const std::string& IP, const std::string& R) {
|
||||
std::packaged_task<std::string()> task([&] { return PostHTTP(IP, R, false); });
|
||||
std::string RunPromise(const std::string& host, const std::string& target, const std::string& R) {
|
||||
std::packaged_task<std::string()> task([&] { return PostHTTP(host, 443, target, R, false); });
|
||||
std::future<std::string> f1 = task.get_future();
|
||||
std::thread t(std::move(task));
|
||||
t.detach();
|
||||
@@ -56,14 +56,12 @@ std::string RunPromise(const std::string& IP, const std::string& R) {
|
||||
R = GenerateCall();
|
||||
if (!CustomIP.empty())
|
||||
R += "&ip=" + CustomIP;
|
||||
std::string link = "https://beammp.com/heartbeatv2";
|
||||
T = RunPromise(link, R);
|
||||
T = RunPromise("https://beammp.com", "/heartbeatv2", R);
|
||||
|
||||
if (T.substr(0, 2) != "20") {
|
||||
//Backend system refused server startup!
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
std::string Backup = "https://backup1.beammp.com/heartbeatv2";
|
||||
T = RunPromise(Backup, R);
|
||||
T = RunPromise("https://backup1.beammp.com", "/heartbeatv2", R);
|
||||
if (T.substr(0, 2) != "20") {
|
||||
warn("Backend system refused server! Server might not show in the public list");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user