Add cvar 'curl_timeout'

New cvar for setting the curl timeout determined in function 'CURLInitRequest'.
This commit is contained in:
Kawe Mazidjatari 2023-03-15 21:33:16 +01:00
parent fc5aa2aafe
commit b3621ba53a
4 changed files with 7 additions and 4 deletions

View File

@ -80,8 +80,9 @@ void ConVar::Init(void)
cm_unset_all_cmdquery = ConVar::Create("cm_unset_all_cmdquery" , "0", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Returns false on every ConVar/ConCommand query ( !warning! ).", false, 0.f, false, 0.f, nullptr, nullptr);
curl_debug = ConVar::Create("curl_debug", "0", FCVAR_DEVELOPMENTONLY, "Determines whether or not to enable curl debug logging.", false, 0.f, false, 0.f, nullptr, "1 = curl logs; 0 (zero) = no logs.");
ssl_verify_peer = ConVar::Create("ssl_verify_peer", "1", FCVAR_DEVELOPMENTONLY, "Verify the authenticity of the peer's SSL certificate.", false, 0.f, false, 0.f, nullptr, "1 = curl verifies; 0 (zero) = no verification.");
curl_debug = ConVar::Create("curl_debug" , "0" , FCVAR_DEVELOPMENTONLY, "Determines whether or not to enable curl debug logging.", false, 0.f, false, 0.f, nullptr, "1 = curl logs; 0 (zero) = no logs.");
curl_timeout = ConVar::Create("curl_timeout" , "15", FCVAR_DEVELOPMENTONLY, "Maximum time in seconds a curl transfer operation could take.", false, 0.f, false, 0.f, nullptr, nullptr);
ssl_verify_peer = ConVar::Create("ssl_verify_peer", "1" , FCVAR_DEVELOPMENTONLY, "Verify the authenticity of the peer's SSL certificate.", false, 0.f, false, 0.f, nullptr, "1 = curl verifies; 0 (zero) = no verification.");
rcon_address = ConVar::Create("rcon_address", "localhost", FCVAR_SERVER_CANNOT_QUERY | FCVAR_DONTRECORD | FCVAR_RELEASE, "Remote server access address.", false, 0.f, false, 0.f, nullptr, nullptr);
rcon_password = ConVar::Create("rcon_password", "" , FCVAR_SERVER_CANNOT_QUERY | FCVAR_DONTRECORD | FCVAR_RELEASE, "Remote server access password (rcon is disabled if empty).", false, 0.f, false, 0.f, &RCON_PasswordChanged_f, nullptr);
@ -222,7 +223,7 @@ void ConVar::Init(void)
net_tracePayload = ConVar::Create("net_tracePayload" , "0", FCVAR_DEVELOPMENTONLY , "Log the payload of the send/recv datagram to a file on the disk.", false, 0.f, false, 0.f, nullptr, nullptr);
net_encryptionEnable = ConVar::Create("net_encryptionEnable" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED , "Use AES encryption on game packets.", false, 0.f, false, 0.f, nullptr, nullptr);
net_useRandomKey = ConVar::Create("net_useRandomKey" , "1" , FCVAR_RELEASE , "Use random AES encryption key for game packets.", false, 0.f, false, 0.f, &NET_UseRandomKeyChanged_f, nullptr);
net_processTimeBudget = ConVar::Create("net_processTimeBudget" ,"200" , FCVAR_RELEASE , "Net message process budget in milliseconds (removing netchannel if exceeded).", true, 0.f, false, 0.f, nullptr, "0 = disabled.");
net_processTimeBudget = ConVar::Create("net_processTimeBudget" ,"200" , FCVAR_RELEASE , "Net message process time budget in milliseconds (removing netchannel if exceeded).", true, 0.f, false, 0.f, nullptr, "0 = disabled.");
//-------------------------------------------------------------------------
// NETWORKSYSTEM |
pylon_matchmaking_hostname = ConVar::Create("pylon_matchmaking_hostname", "ms.r5reloaded.com", FCVAR_RELEASE, "Holds the pylon matchmaking hostname.", false, 0.f, false, 0.f, &MP_HostName_Changed_f, nullptr);

View File

@ -34,6 +34,7 @@ ConVar* host_hasIrreversibleShutdown = nullptr;
ConVar* mp_gamemode = nullptr;
ConVar* curl_debug = nullptr;
ConVar* curl_timeout = nullptr;
ConVar* ssl_verify_peer = nullptr;
ConVar* rcon_address = nullptr;

View File

@ -31,6 +31,7 @@ extern ConVar* host_hasIrreversibleShutdown;
extern ConVar* mp_gamemode;
extern ConVar* curl_debug;
extern ConVar* curl_timeout;
extern ConVar* ssl_verify_peer;
extern ConVar* rcon_address;

View File

@ -39,7 +39,7 @@ CURL* CURLInitRequest(const string& hostname, const string& request, string& res
curl_easy_setopt(curl, CURLOPT_URL, hostname.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, request.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, curl_timeout->GetInt());
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CURLWriteStringCallback);