Skip to content
Permalink
Browse files

Add debug logs for downloads

  • Loading branch information...
Kangz committed Aug 27, 2015
1 parent fbc563b commit ad7edb1ab9aa9b12c8b22f207989341f030d3f81
@@ -172,6 +172,8 @@ clientConnection_t clc;
clientStatic_t cls;
CGameVM cgvm;

Log::Logger downloadLogger("client.pakDownload");

// Structure containing functions exported from refresh DLL
refexport_t re;

@@ -1497,6 +1499,7 @@ Clear download information that we keep in cls (disconnected download support)
*/
void CL_ClearStaticDownload()
{
downloadLogger.Debug("Clearing the download info");
assert( !cls.bWWWDlDisconnected ); // reset before calling
cls.downloadRestart = false;
cls.downloadTempName[ 0 ] = '\0';
@@ -2369,6 +2372,9 @@ void CL_DownloadsComplete()
{
cls.downloadRestart = false;

downloadLogger.Debug("Downloaded something, reload the paks");
downloadLogger.Debug(" The paks to load are '%s'", Cvar_VariableString("sv_paks"));

FS::PakPath::ClearPaks();
FS_LoadServerPaks(Cvar_VariableString("sv_paks"), clc.demoplaying); // We possibly downloaded a pak, restart the file system to load it

@@ -2433,8 +2439,7 @@ game directory.
*/
void CL_BeginDownload( const char *localName, const char *remoteName )
{
Com_DPrintf( "***** CL_BeginDownload *****\n"
"Localname: %s\n" "Remotename: %s\n" "****************************\n", localName, remoteName );
downloadLogger.Debug("Requesting the download of '%s', with remote name '%s'", localName, remoteName);

Q_strncpyz( cls.downloadName, localName, sizeof( cls.downloadName ) );
Com_sprintf( cls.downloadTempName, sizeof( cls.downloadTempName ), "%s.tmp", localName );
@@ -2466,6 +2471,7 @@ void CL_NextDownload()
// We are looking to start a download here
if ( *clc.downloadList )
{
downloadLogger.Debug("CL_NextDownload downloadList is '%s'", clc.downloadList);
s = clc.downloadList;

// format is:
@@ -2543,8 +2549,7 @@ void CL_InitDownloads()

if ( cl_allowDownload->integer && FS_ComparePaks( clc.downloadList, sizeof( clc.downloadList ), true ) )
{
// this gets printed to UI, i18n
Com_DPrintf( "Need paks: %s\n", clc.downloadList );
downloadLogger.Debug("Need paks: '%s'", clc.downloadList);

if ( *clc.downloadList )
{
@@ -3427,6 +3432,7 @@ void CL_WWWDownload()

if ( ret == DL_DONE )
{
downloadLogger.Debug("Finished WWW download of '%s', moving it to '%s'", cls.downloadTempName, cls.originalDownloadName);
// taken from CL_ParseDownload
clc.download = 0;

@@ -644,8 +644,10 @@ void CL_ParseDownload( msg_t *msg )
clc.downloadSize = MSG_ReadLong( msg );
clc.downloadFlags = MSG_ReadLong( msg );

downloadLogger.Debug("Server sent us a new WWW DL '%s', size %i, flags %i",
cls.downloadName, clc.downloadSize, clc.downloadFlags);

Cvar_SetValue( "cl_downloadSize", clc.downloadSize );
Com_DPrintf( "Server redirected download: %s\n", cls.downloadName );
clc.bWWWDl = true; // activate wwwdl client loop
CL_AddReliableCommand( "wwwdl ack" );
cls.state = CA_DOWNLOADING;
@@ -696,6 +698,7 @@ void CL_ParseDownload( msg_t *msg )
// block zero is special, contains file size
clc.downloadSize = MSG_ReadLong( msg );

downloadLogger.Debug("Starting new direct download of size %i for '%s'", clc.downloadSize, cls.downloadTempName);
Cvar_SetValue( "cl_downloadSize", clc.downloadSize );

if ( clc.downloadSize < 0 )
@@ -711,11 +714,13 @@ void CL_ParseDownload( msg_t *msg )
Com_Error( ERR_DROP, "CL_ParseDownload: Invalid size %d for download chunk.", size );
}

downloadLogger.Debug("Received block of size %i", size);

MSG_ReadData( msg, data, size );

if ( clc.downloadBlock != block )
{
Com_DPrintf( "CL_ParseDownload: Expected block %d, got %d\n", clc.downloadBlock, block );
downloadLogger.Debug( "CL_ParseDownload: Expected block %i, got %i", clc.downloadBlock, block );
return;
}

@@ -748,6 +753,7 @@ void CL_ParseDownload( msg_t *msg )

if ( !size )
{
downloadLogger.Debug("Received EOF, closing '%s'", cls.downloadTempName);
// A zero length block means EOF
if ( clc.download )
{
@@ -577,6 +577,8 @@ extern cvar_t *cl_voipShowSender;
extern cvar_t *cl_voip;
#endif

extern Log::Logger downloadLogger;

//=================================================

//
@@ -1432,6 +1432,7 @@ Also called by bot code
==================
*/

Log::Logger clientCommands("server.clientCommands");
void SV_ExecuteClientCommand( client_t *cl, const char *s, bool clientOK, bool premaprestart )
{
ucmd_t *u;
@@ -1444,6 +1445,7 @@ void SV_ExecuteClientCommand( client_t *cl, const char *s, bool clientOK, bool p
return;
}

clientCommands.Debug("Client %s sent command '%s'", cl->name, s);
for (u = ucmds; u->name; u++) {
if (args.Argv(0) == u->name) {
if (premaprestart && !u->allowedpostmapchange) {

0 comments on commit ad7edb1

Please sign in to comment.
You can’t perform that action at this time.