mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 01:05:48 +01:00 
			
		
		
		
	Add configurable curl timeout
This commit is contained in:
		@@ -25,6 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 | 
			
		||||
#include "mods.h"
 | 
			
		||||
#include "config.h"
 | 
			
		||||
#include "log.h"
 | 
			
		||||
#include "main.h" // for g_settings
 | 
			
		||||
#include "settings.h"
 | 
			
		||||
 | 
			
		||||
#if USE_CURL
 | 
			
		||||
#include <curl/curl.h>
 | 
			
		||||
@@ -52,7 +54,7 @@ Json::Value                 fetchJsonValue(const std::string url,
 | 
			
		||||
		curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
 | 
			
		||||
		curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
 | 
			
		||||
		curl_easy_setopt(curl, CURLOPT_WRITEDATA, &liststring);
 | 
			
		||||
 | 
			
		||||
		curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, g_settings->getS32("curl_timeout"));
 | 
			
		||||
		if (chunk != 0)
 | 
			
		||||
			curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -257,6 +257,8 @@ void set_default_settings(Settings *settings)
 | 
			
		||||
 | 
			
		||||
	settings->setDefault("mgmath_generator", "mandelbox");
 | 
			
		||||
 | 
			
		||||
	settings->setDefault("curl_timeout", "5000");
 | 
			
		||||
 | 
			
		||||
	// IPv6
 | 
			
		||||
	settings->setDefault("enable_ipv6", "true");
 | 
			
		||||
	settings->setDefault("ipv6_server", "false");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user