diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /replay/cl_sessionblockdownloader.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'replay/cl_sessionblockdownloader.h')
| -rw-r--r-- | replay/cl_sessionblockdownloader.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/replay/cl_sessionblockdownloader.h b/replay/cl_sessionblockdownloader.h new file mode 100644 index 0000000..354ef3f --- /dev/null +++ b/replay/cl_sessionblockdownloader.h @@ -0,0 +1,64 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +//---------------------------------------------------------------------------------------- + +#ifndef CL_SESSIONBLOCKDOWNLOADER_H +#define CL_SESSIONBLOCKDOWNLOADER_H +#ifdef _WIN32 +#pragma once +#endif + +//---------------------------------------------------------------------------------------- + +#include "utllinkedlist.h" +#include "cl_downloader.h" +#include "basethinker.h" +#include "replay/replayhandle.h" + +//---------------------------------------------------------------------------------------- + +class CClientRecordingSession; + +//---------------------------------------------------------------------------------------- + +// +// Downloads multiple session blocks concurrently and updates their status. +// +class CSessionBlockDownloader : public CBaseThinker, + public IDownloadHandler +{ +public: + CSessionBlockDownloader(); + + void Shutdown(); + void Think(); + + // If pSession is NULL, all remaining downloads will affected. + void AbortDownloadsAndCleanup( CClientRecordingSession *pSession ); + +private: + bool AtMaxConcurrentDownloads() const; + + // + // CBaseThinker + // + virtual float GetNextThinkTime() const; + + // + // IDownloadHandler + // + virtual void OnConnecting( CHttpDownloader *pDownloader ); + virtual void OnFetch( CHttpDownloader *pDownloader ); + virtual void OnDownloadComplete( CHttpDownloader *pDownloader, const unsigned char *pData ); + + static int sm_nNumCurrentDownloads; + + CUtlLinkedList< CHttpDownloader *, int > m_lstDownloaders; + int m_nMaxBlock; + + friend class CErrorSystem; +}; + +//---------------------------------------------------------------------------------------- + +#endif // CL_SESSIONBLOCKDOWNLOADER_H |