Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //----------------------------------------------------------------------------------------
  4. #ifndef CL_SESSIONBLOCKDOWNLOADER_H
  5. #define CL_SESSIONBLOCKDOWNLOADER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "utllinkedlist.h"
  11. #include "cl_downloader.h"
  12. #include "basethinker.h"
  13. #include "replay/replayhandle.h"
  14. //----------------------------------------------------------------------------------------
  15. class CClientRecordingSession;
  16. //----------------------------------------------------------------------------------------
  17. //
  18. // Downloads multiple session blocks concurrently and updates their status.
  19. //
  20. class CSessionBlockDownloader : public CBaseThinker,
  21. public IDownloadHandler
  22. {
  23. public:
  24. CSessionBlockDownloader();
  25. void Shutdown();
  26. void Think();
  27. // If pSession is NULL, all remaining downloads will affected.
  28. void AbortDownloadsAndCleanup( CClientRecordingSession *pSession );
  29. private:
  30. bool AtMaxConcurrentDownloads() const;
  31. //
  32. // CBaseThinker
  33. //
  34. virtual float GetNextThinkTime() const;
  35. //
  36. // IDownloadHandler
  37. //
  38. virtual void OnConnecting( CHttpDownloader *pDownloader );
  39. virtual void OnFetch( CHttpDownloader *pDownloader );
  40. virtual void OnDownloadComplete( CHttpDownloader *pDownloader, const unsigned char *pData );
  41. static int sm_nNumCurrentDownloads;
  42. CUtlLinkedList< CHttpDownloader *, int > m_lstDownloaders;
  43. int m_nMaxBlock;
  44. friend class CErrorSystem;
  45. };
  46. //----------------------------------------------------------------------------------------
  47. #endif // CL_SESSIONBLOCKDOWNLOADER_H