mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
fix rare error condition with downloads under DP protocol
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2587 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
cf1a12ee11
commit
03ce73bb55
1 changed files with 20 additions and 14 deletions
|
@ -1402,7 +1402,7 @@ void CLDP_ParseDownloadBegin(char *s)
|
||||||
|
|
||||||
void CLDP_ParseDownloadFinished(char *s)
|
void CLDP_ParseDownloadFinished(char *s)
|
||||||
{
|
{
|
||||||
unsigned short runningcrc;
|
unsigned short runningcrc = 0;
|
||||||
char buffer[8192];
|
char buffer[8192];
|
||||||
int size, pos, chunk;
|
int size, pos, chunk;
|
||||||
if (!cls.downloadqw)
|
if (!cls.downloadqw)
|
||||||
|
@ -1426,20 +1426,26 @@ void CLDP_ParseDownloadFinished(char *s)
|
||||||
QCRC_AddBlock(&runningcrc, buffer, chunk);
|
QCRC_AddBlock(&runningcrc, buffer, chunk);
|
||||||
}
|
}
|
||||||
VFS_CLOSE (cls.downloadqw);
|
VFS_CLOSE (cls.downloadqw);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Con_Printf("Download failed: unable to check CRC of download\n");
|
||||||
|
CL_DownloadFailed(cls.downloadname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Cmd_TokenizeString(s+1, false, false);
|
Cmd_TokenizeString(s+1, false, false);
|
||||||
if (size != atoi(Cmd_Argv(1)))
|
if (size != atoi(Cmd_Argv(1)))
|
||||||
{
|
{
|
||||||
Con_Printf("Download failed: wrong file size\n");
|
Con_Printf("Download failed: wrong file size\n");
|
||||||
CL_DownloadFailed(cls.downloadname);
|
CL_DownloadFailed(cls.downloadname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (runningcrc != atoi(Cmd_Argv(2)))
|
if (runningcrc != atoi(Cmd_Argv(2)))
|
||||||
{
|
{
|
||||||
Con_Printf("Download failed: wrong crc\n");
|
Con_Printf("Download failed: wrong crc\n");
|
||||||
CL_DownloadFailed(cls.downloadname);
|
CL_DownloadFailed(cls.downloadname);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CL_FinishDownload(cls.downloadname, cls.downloadtempname);
|
CL_FinishDownload(cls.downloadname, cls.downloadtempname);
|
||||||
|
|
Loading…
Reference in a new issue