From 27039932722489e33ceb9b416d3b57176b804536 Mon Sep 17 00:00:00 2001 From: cppla <i@cpp.la> Date: Sat, 16 Jul 2022 13:45:37 +0800 Subject: [PATCH] add timeout for libcurl --- server/src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/main.cpp b/server/src/main.cpp index f9e40fa..62a4217 100644 --- a/server/src/main.cpp +++ b/server/src/main.cpp @@ -345,6 +345,8 @@ void CMain::WatchdogMessage(int ClientNetID, double load_1, double load_5, doubl curl_easy_setopt(curl, CURLOPT_URL, urlBuffer); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 3L); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 6L); res = curl_easy_perform(curl); if(res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));