Revert "engine: client: implement connectionprogress partially"

This reverts commit cb417a3d51.

This commit breaks demo playback. Figure out why, then revert it back.
This commit is contained in:
Alibek Omarov
2019-10-06 07:43:57 +03:00
parent 39ff3b199a
commit d2a8cfe614
6 changed files with 13 additions and 65 deletions

View File

@@ -1812,8 +1812,6 @@ static struct http_static_s
// file and server lists
httpfile_t *first_file, *last_file;
httpserver_t *first_server, *last_server;
int fileCount;
} http;
@@ -1852,8 +1850,6 @@ static void HTTP_FreeFile( httpfile_t *file, qboolean error )
{
char incname[256];
http.fileCount--;
// Allways close file and socket
if( file->file )
FS_Close( file->file );
@@ -2017,11 +2013,6 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile )
return false;
}
#ifndef XASH_DEDICATED
UI_ConnectionProgress_Download( curfile->path, curfile->server->host, curfile->server->path,
curfile->id, http.fileCount, va( "(file size is %d)", curfile->size ) );
#endif // XASH_DEDICATED
curfile->state = HTTP_RESPONSE_RECEIVED; // got response, let's start download
begin += 4;
@@ -2063,16 +2054,9 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile )
// as after it will run in same frame
if( curfile->checktime > 5 )
{
float speed = (float)curfile->lastchecksize / ( 5.0 * 1024 );
curfile->checktime = 0;
Con_Reportf( "download speed %.2f KB/s\n", speed );
Con_Reportf( "download speed %f KB/s\n", (float)curfile->lastchecksize / ( 5.0 * 1024 ) );
curfile->lastchecksize = 0;
#ifndef XASH_DEDICATED
UI_ConnectionProgress_Download( curfile->path, curfile->server->host, curfile->server->path,
curfile->id, http.fileCount, va( "(file size is %d, speed is %.2f KB/s)", curfile->size, speed ) );
#endif // XASH_DEDICATED
}
}
}
@@ -2120,9 +2104,6 @@ void HTTP_Run( void )
}
Con_Reportf( "HTTP: Starting download %s from %s\n", curfile->path, curfile->server->host );
#ifndef XASH_DEDICATED
UI_ConnectionProgress_Download( curfile->path, curfile->server->host, curfile->server->path, curfile->id, http.fileCount, "(starting)");
#endif // XASH_DEDICATED
Q_snprintf( name, sizeof( name ), "downloaded/%s.incomplete", curfile->path );
curfile->file = FS_Open( name, "wb", true );
@@ -2218,10 +2199,6 @@ void HTTP_Run( void )
{
qboolean wait = false;
#ifndef XASH_DEDICATED
UI_ConnectionProgress_Download( curfile->path, curfile->server->host, curfile->server->path, curfile->id, http.fileCount, "(sending request)");
#endif // XASH_DEDICATED
while( curfile->bytes_sent < curfile->query_length )
{
res = send( curfile->socket, curfile->buf + curfile->bytes_sent, curfile->query_length - curfile->bytes_sent, 0 );
@@ -2311,8 +2288,6 @@ void HTTP_AddDownload( const char *path, int size, qboolean process )
Con_Reportf( "File %s queued to download\n", path );
http.fileCount++;
httpfile->size = size;
httpfile->downloaded = 0;
httpfile->socket = -1;
@@ -2456,7 +2431,6 @@ Clear all queue
static void HTTP_Clear_f( void )
{
http.last_file = NULL;
http.fileCount = 0;
while( http.first_file )
{
@@ -2557,7 +2531,6 @@ void HTTP_Init( void )
http.last_server = NULL;
http.first_file = http.last_file = NULL;
http.fileCount = 0;
Cmd_AddCommand("http_download", &HTTP_Download_f, "add file to download queue");
Cmd_AddCommand("http_skip", &HTTP_Skip_f, "skip current download server");