mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-30 04:50:55 +00:00
Set timeout on HMS connections
This commit is contained in:
parent
bd3ea52cba
commit
fcbe4e668f
3 changed files with 8 additions and 0 deletions
|
@ -34,6 +34,11 @@ Documentation available here.
|
||||||
|
|
||||||
static void MasterServer_Debug_OnChange (void);
|
static void MasterServer_Debug_OnChange (void);
|
||||||
|
|
||||||
|
consvar_t cv_masterserver_timeout = {
|
||||||
|
"masterserver_timeout", "5", CV_SAVE, CV_Unsigned,
|
||||||
|
NULL, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
|
||||||
|
};
|
||||||
|
|
||||||
consvar_t cv_masterserver_debug = {
|
consvar_t cv_masterserver_debug = {
|
||||||
"masterserver_debug", "Off", CV_SAVE|CV_CALL, CV_OnOff,
|
"masterserver_debug", "Off", CV_SAVE|CV_CALL, CV_OnOff,
|
||||||
MasterServer_Debug_OnChange, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
|
MasterServer_Debug_OnChange, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
|
||||||
|
@ -165,6 +170,7 @@ HMS_connect (const char *format, ...)
|
||||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||||
|
|
||||||
|
curl_easy_setopt(curl, CURLOPT_TIMEOUT, cv_masterserver_timeout.value);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ void AddMServCommands(void)
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
CV_RegisterVar(&cv_masterserver);
|
CV_RegisterVar(&cv_masterserver);
|
||||||
CV_RegisterVar(&cv_masterserver_update_rate);
|
CV_RegisterVar(&cv_masterserver_update_rate);
|
||||||
|
CV_RegisterVar(&cv_masterserver_timeout);
|
||||||
CV_RegisterVar(&cv_masterserver_debug);
|
CV_RegisterVar(&cv_masterserver_debug);
|
||||||
CV_RegisterVar(&cv_servername);
|
CV_RegisterVar(&cv_servername);
|
||||||
COM_AddCommand("listserv", Command_Listserv_f);
|
COM_AddCommand("listserv", Command_Listserv_f);
|
||||||
|
|
|
@ -66,6 +66,7 @@ typedef struct
|
||||||
|
|
||||||
extern consvar_t cv_masterserver, cv_servername;
|
extern consvar_t cv_masterserver, cv_servername;
|
||||||
extern consvar_t cv_masterserver_update_rate;
|
extern consvar_t cv_masterserver_update_rate;
|
||||||
|
extern consvar_t cv_masterserver_timeout;
|
||||||
extern consvar_t cv_masterserver_debug;
|
extern consvar_t cv_masterserver_debug;
|
||||||
|
|
||||||
// < 0 to not connect (usually -1) (offline mode)
|
// < 0 to not connect (usually -1) (offline mode)
|
||||||
|
|
Loading…
Reference in a new issue