X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=libcurl.c;h=843fb74a686b200fa748358427c6bed6982c0a5f;hb=d5ea21772f2ee1609671ebd393a10f71892db483;hp=3cabcef54be4b3242f29cba404981d2f655a27c3;hpb=d1b6a97fd7efe855c6b271050bddba467da11e39;p=xonotic%2Fdarkplaces.git diff --git a/libcurl.c b/libcurl.c index 3cabcef5..843fb74a 100644 --- a/libcurl.c +++ b/libcurl.c @@ -2,11 +2,11 @@ #include "fs.h" #include "libcurl.h" -static cvar_t cl_curl_maxdownloads = {1, "cl_curl_maxdownloads","1", "maximum number of concurrent HTTP/FTP downloads"}; -static cvar_t cl_curl_maxspeed = {1, "cl_curl_maxspeed","100", "maximum download speed (KiB/s)"}; -static cvar_t sv_curl_defaulturl = {1, "sv_curl_defaulturl","", "default autodownload source URL"}; -static cvar_t sv_curl_serverpackages = {1, "sv_curl_serverpackages","", "list of required files for the clients, separated by spaces"}; -static cvar_t cl_curl_enabled = {1, "cl_curl_enabled","0", "whether client's download support is enabled"}; +static cvar_t cl_curl_maxdownloads = {CVAR_SAVE, "cl_curl_maxdownloads","1", "maximum number of concurrent HTTP/FTP downloads"}; +static cvar_t cl_curl_maxspeed = {CVAR_SAVE, "cl_curl_maxspeed","100", "maximum download speed (KiB/s)"}; +static cvar_t sv_curl_defaulturl = {CVAR_SAVE, "sv_curl_defaulturl","", "default autodownload source URL"}; +static cvar_t sv_curl_serverpackages = {CVAR_SAVE, "sv_curl_serverpackages","", "list of required files for the clients, separated by spaces"}; +static cvar_t cl_curl_enabled = {CVAR_SAVE, "cl_curl_enabled","1", "whether client's download support is enabled"}; /* ================================================================= @@ -281,7 +281,7 @@ static void Curl_CheckCommandWhenDone() return; if(numdownloads_added && (numdownloads_success == numdownloads_added) && *command_when_done) { - Con_DPrintf("Map downloads occurred, executing %s\n", command_when_done); + Con_DPrintf("cURL downloads occurred, executing %s\n", command_when_done); Cbuf_AddText("\n"); Cbuf_AddText(command_when_done); Cbuf_AddText("\n"); @@ -289,7 +289,7 @@ static void Curl_CheckCommandWhenDone() } else if(numdownloads_added && numdownloads_fail && *command_when_error) { - Con_DPrintf("Map downloads FAILED, executing %s\n", command_when_error); + Con_DPrintf("cURL downloads FAILED, executing %s\n", command_when_error); Cbuf_AddText("\n"); Cbuf_AddText(command_when_error); Cbuf_AddText("\n"); @@ -311,12 +311,16 @@ static qboolean CURL_OpenLibrary (void) #if defined(WIN64) "libcurl64.dll", #elif defined(WIN32) + "libcurl-4.dll", "libcurl-3.dll", #elif defined(MACOSX) + "libcurl.4.dylib", // Mac OS X Notyetreleased "libcurl.3.dylib", // Mac OS X Tiger "libcurl.2.dylib", // Mac OS X Panther #else + "libcurl.so.4", "libcurl.so.3", + "libcurl.so", // FreeBSD #endif NULL }; @@ -642,7 +646,7 @@ void Curl_Begin(const char *URL, const char *name, qboolean ispak, qboolean fort return; } } - + if(ispak && FS_FileExists(fn)) { qboolean already_loaded; @@ -737,7 +741,7 @@ void Curl_Run() { int remaining; CURLMcode mc; - + do { mc = qcurl_multi_perform(curlm, &remaining); @@ -773,7 +777,7 @@ void Curl_Run() break; } } - + Curl_EndDownload(di, failed, result); } } @@ -1030,7 +1034,7 @@ void Curl_Curl_f(void) char donecommand[256]; if(cls.netcon) { - if(cls.signon >= 3) + if(cl.loadbegun) // curling won't inhibit loading the map any more when at this stage, so bail out and force a reconnect { dpsnprintf(donecommand, sizeof(donecommand), "connect %s", cls.netcon->address); Curl_CommandWhenDone(donecommand); @@ -1120,7 +1124,7 @@ Curl_downloadinfo_t *Curl_GetDownloadInfo(int *nDownloads, const char **addition } ++i; } - + if(additional_info) { // TODO: can I clear command_when_done as soon as the first download fails? @@ -1178,7 +1182,7 @@ static const char *Curl_FindPackURL(const char *filename) char *p = buf; char *pattern = NULL, *patternend = NULL, *url = NULL, *urlend = NULL; qboolean eof = false; - + pattern = p; while(!eof) { @@ -1272,7 +1276,7 @@ void Curl_ClearRequirements() } p = sv_curl_serverpackages.string; Con_DPrintf("Require all of: %s\n", p); - while(COM_ParseTokenConsole(&p)) + while(COM_ParseToken_Simple(&p, false, false)) { Con_DPrintf("Require: %s\n", com_token); Curl_RequireFile(com_token);