From e2a45601b307c9a8630e87b1f8db167ec996840e Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Tue, 17 Nov 2020 23:21:21 +0100 Subject: [PATCH] possibly fix recurring backend timeout --- src/Init/Heartbeat.cpp | 2 +- src/Network/Http.cpp | 1 + src/logger.cpp | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Init/Heartbeat.cpp b/src/Init/Heartbeat.cpp index c20f73e..7ceb82d 100644 --- a/src/Init/Heartbeat.cpp +++ b/src/Init/Heartbeat.cpp @@ -34,7 +34,7 @@ std::string GenerateCall() { return Ret.str(); } std::string RunPromise(const std::string& IP, const std::string& R) { - std::packaged_task task([&]() { return PostHTTP(IP, R); }); + std::packaged_task task([&] { return PostHTTP(IP, R); }); std::future f1 = task.get_future(); std::thread t(std::move(task)); t.detach(); diff --git a/src/Network/Http.cpp b/src/Network/Http.cpp index 996d18f..19b3b04 100644 --- a/src/Network/Http.cpp +++ b/src/Network/Http.cpp @@ -43,6 +43,7 @@ std::string PostHTTP(const std::string& IP, const std::string& Fields) { curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5); res = curl_easy_perform(curl); curl_easy_cleanup(curl); if (res != CURLE_OK) diff --git a/src/logger.cpp b/src/logger.cpp index 73e7bb9..99e231b 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include static RWMutex ThreadNameMapMutex; @@ -95,7 +94,7 @@ void DebugPrintTIDInternal(const std::string& func, bool overwrite) { #ifdef DEBUG std::scoped_lock Guard(LogLock); std::stringstream Print; - Print << "(debug build) Thread '" << std::this_thread::get_id() << "' / '" << gettid() << "' is " << func << "\n"; + Print << "(debug build) Thread '" << std::this_thread::get_id() << "' is " << func << "\n"; ConsoleOut(Print.str()); #endif // DEBUG }