mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 14:00:58 +00:00
Abort downloads if a server hasn't a file over UDP.
This is a special case, the bug was already present in Vanilla Q2: If a server is offering assets for download but is missing some files the USP download code runs in an endless loop. CL_ParseDownload() detects that something is wrong and calls CL_RequestNextDownload() which tries to download the same file again... Work around this by skippig over that file. This closes #552.
This commit is contained in:
parent
7f339952cb
commit
ffe8f893ed
1 changed files with 22 additions and 3 deletions
|
@ -56,6 +56,8 @@ static qboolean httpSecondChance = true;
|
|||
- 3: Third iteration, UDP downloads. */
|
||||
static unsigned int precacherIteration;
|
||||
|
||||
static qboolean skip_textures;
|
||||
|
||||
// r1q2 searches the global filelist at /, q2pro at /gamedir...
|
||||
static qboolean gamedirForFilelist;
|
||||
|
||||
|
@ -422,7 +424,10 @@ CL_RequestNextDownload(void)
|
|||
#endif
|
||||
|
||||
/* precache phase completed */
|
||||
precache_check = ENV_CNT + 1;
|
||||
if (!skip_textures)
|
||||
{
|
||||
precache_check = ENV_CNT + 1;
|
||||
}
|
||||
|
||||
CM_LoadMap(cl.configstrings[CS_MODELS + 1], true, &map_checksum);
|
||||
|
||||
|
@ -506,6 +511,7 @@ CL_RequestNextDownload(void)
|
|||
precacherIteration = 0;
|
||||
gamedirForFilelist = false;
|
||||
httpSecondChance = true;
|
||||
skip_textures = false;
|
||||
|
||||
#ifdef USE_CURL
|
||||
dlquirks.filelist = true;
|
||||
|
@ -699,9 +705,9 @@ CL_Download_f(void)
|
|||
void
|
||||
CL_ParseDownload(void)
|
||||
{
|
||||
int size, percent;
|
||||
char name[MAX_OSPATH];
|
||||
int r;
|
||||
int r, percent, size;
|
||||
static qboolean second_try;
|
||||
|
||||
/* read the data */
|
||||
size = MSG_ReadShort(&net_message);
|
||||
|
@ -719,10 +725,23 @@ CL_ParseDownload(void)
|
|||
cls.download = NULL;
|
||||
}
|
||||
|
||||
if (second_try)
|
||||
{
|
||||
precache_check = ENV_CNT + 999;
|
||||
skip_textures = true;
|
||||
second_try = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
second_try = true;
|
||||
}
|
||||
|
||||
CL_RequestNextDownload();
|
||||
return;
|
||||
}
|
||||
|
||||
second_try = false;
|
||||
|
||||
/* open the file if not opened yet */
|
||||
if (!cls.download)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue