mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 12:41:21 +00:00
Download the generic filelist only once.
Cleaning the download queue as soon as a file finished downloading leads in combination with only one parallel download and multiple precacher runs to an ugly problem: The generic filelist is requested several time which can lead to cycles. Hack around this by rembering if we already requested it and reset set reminder as soon as the precacher finished. Yes, I'm feeling dirty.
This commit is contained in:
parent
5e67596d56
commit
d38929170b
3 changed files with 19 additions and 3 deletions
|
@ -455,6 +455,9 @@ CL_RequestNextDownload(void)
|
|||
/* This map was done, allow HTTP again for next map. */
|
||||
forceudp = false;
|
||||
|
||||
/* And generic filelists for next map. */
|
||||
CL_HTTP_EnableGenericFilelist();
|
||||
|
||||
CL_RegisterSounds();
|
||||
CL_PrepRefresh();
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ static int pendingCount = 0;
|
|||
static int abortDownloads = HTTPDL_ABORT_NONE;
|
||||
static qboolean httpDown = false;
|
||||
static qboolean downloadError = false;
|
||||
static qboolean downloadFilelist = true;
|
||||
|
||||
// --------
|
||||
|
||||
|
@ -996,9 +997,10 @@ qboolean CL_QueueHTTPDownload(const char *quakePath)
|
|||
// the generic(!) filelist.
|
||||
qboolean needList = false;
|
||||
|
||||
if (!cls.downloadQueue.next && cl_http_filelists->value)
|
||||
if (downloadFilelist && cl_http_filelists->value)
|
||||
{
|
||||
needList = true;
|
||||
downloadFilelist = false;
|
||||
}
|
||||
|
||||
// Queue the download.
|
||||
|
@ -1072,10 +1074,11 @@ qboolean CL_PendingHTTPDownloads(void)
|
|||
return pendingCount + handleCount;
|
||||
}
|
||||
|
||||
/* Checks if there was an error. Returns
|
||||
/*
|
||||
* Checks if there was an error. Returns
|
||||
* true if yes, and false if not.
|
||||
*/
|
||||
qboolean CL_CheckHTTPError()
|
||||
qboolean CL_CheckHTTPError(void)
|
||||
{
|
||||
if (downloadError)
|
||||
{
|
||||
|
@ -1088,6 +1091,15 @@ qboolean CL_CheckHTTPError()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enables generic file list download starting
|
||||
* with the next file. Yes, this is dirty.
|
||||
*/
|
||||
void CL_HTTP_EnableGenericFilelist(void)
|
||||
{
|
||||
downloadFilelist = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calls CURL to perform the actual downloads.
|
||||
* Must be called every frame, otherwise CURL
|
||||
|
|
|
@ -73,6 +73,7 @@ qboolean CL_PendingHTTPDownloads(void);
|
|||
void CL_SetHTTPServer(const char *URL);
|
||||
void CL_HTTP_Cleanup(qboolean fullShutdown);
|
||||
qboolean CL_CheckHTTPError();
|
||||
void CL_HTTP_EnableGenericFilelist(void);
|
||||
|
||||
#endif // DOWNLOAD_H
|
||||
#endif // USE_CURL
|
||||
|
|
Loading…
Reference in a new issue