Remove canceling of all downloads if the bsp failed to download...

...and fix the bugs, that were worked around with that crap, instead.
This removes some corner cases like cancelation of all HTTP downloads
and fallback to UDP if too many 404 errors were generated. If this is
still a problem in reality - for example HTTP servers blocking the
client after too many 404 or even crashing HTTP server - fix the server
and don't force the clients to work around that.
This commit is contained in:
Yamagi Burmeister 2018-12-05 19:28:10 +01:00
parent 7f085db431
commit 29f9f48a06
3 changed files with 4 additions and 30 deletions

View File

@ -47,8 +47,6 @@ static int handleCount = 0;
static int pendingCount = 0;
static int abortDownloads = HTTPDL_ABORT_NONE;
static qboolean httpDown = false;
static qboolean thisMapAbort = false; // TODO CURL: Raußreißen?
// --------
@ -576,17 +574,6 @@ static void CL_FinishHTTPDownload(void)
// TODO CURL: Rausreißen?
Com_Printf ("HTTP(%s): 404 File Not Found [%d remaining files]\n", dl->queueEntry->quakePath, pendingCount);
// TODO CURL: Rausreißen?
if (!strncmp(dl->queueEntry->quakePath, "maps/", 5) && !strcmp(dl->queueEntry->quakePath + i - 4, ".bsp"))
{
Com_Printf("HTTP: failed to download %s, falling back to UDP until next map.\n", dl->queueEntry->quakePath);
CL_CancelHTTPDownloads (false);
CL_ResetPrecacheCheck ();
thisMapAbort = true;
}
continue;
}
else if (responseCode == 200)
@ -635,7 +622,7 @@ static void CL_FinishHTTPDownload(void)
default:
// TODO CURL: Rausreißen?
Com_Printf ("HTTP download failed: %s\n", curl_easy_strerror (result));
Com_Printf ("HTTP download failed: %s\n", curl_easy_strerror(result));
i = strlen(dl->queueEntry->quakePath);
@ -915,7 +902,7 @@ qboolean CL_QueueHTTPDownload(const char *quakePath)
{
// Not HTTP servers were send by the server, HTTP is disabled
// or the client is shutting down and we're wrapping up.
if (!cls.downloadServer[0] || abortDownloads || thisMapAbort || !cl_http_downloads->value)
if (!cls.downloadServer[0] || abortDownloads || !cl_http_downloads->value)
{
return false;
}
@ -953,7 +940,7 @@ qboolean CL_QueueHTTPDownload(const char *quakePath)
// Let's download the generic filelist if necessary.
if (needList)
{
CL_QueueHTTPDownload (va("%s.filelist", cl.gamedir));
CL_QueueHTTPDownload("/.filelist");
}
// If we just queued a .bsp file ask for it's map
@ -973,7 +960,7 @@ qboolean CL_QueueHTTPDownload(const char *quakePath)
COM_StripExtension (filePath, listPath);
Q_strlcat(listPath, ".filelist", sizeof(listPath));
CL_QueueHTTPDownload (listPath);
CL_QueueHTTPDownload(listPath);
}
// If we're here CL_FinishHTTPDownload() is guaranteed to be called.
@ -998,14 +985,6 @@ qboolean CL_PendingHTTPDownloads(void)
return pendingCount + handleCount;
}
/*
* Resets the map abort state.
*/
void CL_HTTP_ResetMapAbort (void)
{
thisMapAbort = false;
}
/*
* Calls CURL to perform the actual downloads.
* Must be called every frame, otherwise CURL

View File

@ -467,10 +467,6 @@ CL_Precache_f(void)
precache_model = 0;
precache_model_skin = 0;
#ifdef USE_CURL
CL_HTTP_ResetMapAbort();
#endif
CL_RequestNextDownload();
}

View File

@ -69,6 +69,5 @@ void CL_RunHTTPDownloads(void);
qboolean CL_PendingHTTPDownloads(void);
void CL_SetHTTPServer(const char *URL);
void CL_HTTP_Cleanup(qboolean fullShutdown);
void CL_HTTP_ResetMapAbort(void);
#endif