summaryrefslogtreecommitdiff
path: root/replay/sv_sessionpublishmanager.h
blob: c928915547d0ad1006ea46a8652636f0ed7df703 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//

#ifndef SV_SESSIONPUBLISHMANAGER_H
#define SV_SESSIONPUBLISHMANAGER_H
#ifdef _WIN32
#pragma once
#endif

//----------------------------------------------------------------------------------------

#include "replay/replayhandle.h"

//----------------------------------------------------------------------------------------

class CServerRecordingSession;
class CSessionBlockPublisher;
class CSessionInfoPublisher;

//----------------------------------------------------------------------------------------

//
// CSessionPublishManager takes care of all the publishing for a particular session.
// For asynchronous publishing of block and session info data, publishing can
// sometimes overlap between rounds, as is sometimes the case for FTP.
//
// A CSessionPublishManager instance are created by passing in the in-progress recording
// session into the constructor.
//
// CSessionRecorder maintains a list of CSessionPublishManager instances and cleans
// them up once all publishing for their corresponding session is completed.
//

class CSessionPublishManager
{
public:
	CSessionPublishManager( CServerRecordingSession *pSession );
	~CSessionPublishManager();

	void				Think();	// Called explicitly

	// Finish any publish jobs synchronously
	void				PublishAllSynchronous();

	// Have all publish job completed?
	bool				IsDone() const;

	// This will flag this publish manager as recording
	void				OnStartRecording();

	// This will write out and publish any final session block
	void				OnStopRecord( bool bAborting );

	// Get the handle for the associated session
	ReplayHandle_t		GetSessionHandle() const;

	// Unlock the associated session - this should only be called if IsDone() returns true.
	void				UnlockSession();

	// Abort publishing
	void				AbortPublish();

#ifdef _DEBUG
	void				Validate();
#endif

private:
	CServerRecordingSession	*m_pSession;
	CSessionBlockPublisher	*m_pBlockPublisher;
	CSessionInfoPublisher	*m_pSessionInfoPublisher;
};

//----------------------------------------------------------------------------------------

#endif	// SV_SESSIONPUBLISHMANAGER_H