mirror of
https://github.com/rehlds/rehlds.git
synced 2025-02-27 22:11:07 +03:00
Netchan_CreateFileFragments: Fixed a very old and rare bug with dlfile while downloading direct from server, when content of resource size is less than header size first fragment
This commit is contained in:
parent
e9045e3b63
commit
d76b06dcc2
@ -1158,6 +1158,9 @@ void Netchan_CreateFileFragmentsFromBuffer(qboolean server, netchan_t *chan, con
|
||||
MSG_WriteString(&buf->frag_message, filename);
|
||||
MSG_WriteString(&buf->frag_message, bCompressed ? "bz2" : "uncompressed");
|
||||
MSG_WriteLong(&buf->frag_message, uncompressed_size);
|
||||
|
||||
// Check if we aren't send more than we should
|
||||
if ((chunksize - send) < buf->frag_message.cursize)
|
||||
send -= buf->frag_message.cursize;
|
||||
}
|
||||
|
||||
@ -1321,7 +1324,7 @@ int Netchan_CreateFileFragments_(qboolean server, netchan_t *chan, const char *f
|
||||
remaining = filesize;
|
||||
pos = 0;
|
||||
|
||||
while (remaining)
|
||||
while (remaining > 0)
|
||||
{
|
||||
send = min(chunksize, remaining);
|
||||
buf = Netchan_AllocFragbuf();
|
||||
@ -1353,6 +1356,9 @@ int Netchan_CreateFileFragments_(qboolean server, netchan_t *chan, const char *f
|
||||
MSG_WriteString(&buf->frag_message, filename);
|
||||
MSG_WriteString(&buf->frag_message, bCompressed ? "bz2" : "uncompressed");
|
||||
MSG_WriteLong(&buf->frag_message, uncompressed_size);
|
||||
|
||||
// Check if we aren't send more than we should
|
||||
if ((chunksize - send) < buf->frag_message.cursize)
|
||||
send -= buf->frag_message.cursize;
|
||||
}
|
||||
buf->isfile = TRUE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user