Skip to content

Commit

Permalink
Merge pull request #127 from QW-Group/download-buff
Browse files Browse the repository at this point in the history
DOWNLOAD: bump download speed
  • Loading branch information
tcsabina authored Jul 21, 2023
2 parents 20b2f98 + 82574bc commit 04a786e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/sv_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cvar_t sv_kickuserinfospamcount = {"sv_kickuserinfospamcount", "300"};
cvar_t sv_maxuploadsize = {"sv_maxuploadsize", "1048576"};

#ifdef FTE_PEXT_CHUNKEDDOWNLOADS
cvar_t sv_downloadchunksperframe = {"sv_downloadchunksperframe", "2"};
cvar_t sv_downloadchunksperframe = {"sv_downloadchunksperframe", "15"};
#endif

#ifdef FTE_PEXT2_VOICECHAT
Expand Down Expand Up @@ -1105,6 +1105,7 @@ void SV_NextChunkedDownload(int chunknum, int percent, int chunked_download_numb
#define CHUNKSIZE 1024
char buffer[CHUNKSIZE];
int i;
int maxchunks = bound(1, (int)sv_downloadchunksperframe.value, 30);

sv_client->file_percent = bound(0, percent, 100); //bliP: file percent

Expand All @@ -1114,13 +1115,9 @@ void SV_NextChunkedDownload(int chunknum, int percent, int chunked_download_numb
return;
}

if (sv_client->download_chunks_perframe)
{
int maxchunks = bound(1, (int)sv_downloadchunksperframe.value, 4);
// too much requests or client sent something wrong
if (sv_client->download_chunks_perframe >= maxchunks || chunked_download_number < 1)
return;
}
// Check if too much requests or client sent something wrong
if (sv_client->download_chunks_perframe >= maxchunks || chunked_download_number < 1)
return;

if (!sv_client->download_chunks_perframe) // ignore "rate" if not first packet per frame
if (sv_client->datagram.cursize + CHUNKSIZE+5+50 > sv_client->datagram.maxsize)
Expand Down

0 comments on commit 04a786e

Please sign in to comment.