DragonNest/Common/NetworkLib/ConnectionManager.h
2024-12-20 16:56:44 +08:00

52 lines
No EOL
2.4 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#if defined(_SERVER)
#include "Connection.h"
using namespace std;
const BYTE CONNECTIONPROCESSCOUNT = 40; // 초당 오브젝트 처리개수
typedef vector<CConnection*> TVecConnections;
typedef map<UINT, CConnection*> TMapConnections;
class CConnectionManager
{
private:
protected:
int m_nProcessCount;
TVecConnections m_Connections;
TMapConnections m_KeyConnections;
#ifdef _USE_ACCEPTEX
public:
#endif
CSyncLock m_ConSync;
public:
CConnectionManager(void);
#ifdef _USE_ACCEPTEX
CConnectionManager( UINT uiWorkerThreadCount );
#endif
virtual ~CConnectionManager(void);
virtual void Clear();
virtual void DoUpdate(DWORD CurTick);
virtual CConnection* AddConnection(const char *pIp, const USHORT nPort) = 0;
bool DelConnection(CConnection *pCon);
int PushConnection(CConnection *pCon);
#ifdef _USE_ACCEPTEX
virtual CConnection* GetConnection(UINT nUID, bool bDoLock = true);
virtual CConnection* GetConnectionByIPPort(const char *pIp, const USHORT nPort);
#else
CConnection* GetConnection(UINT nUID, bool bDoLock = true);
CConnection* GetConnectionByIPPort(const char *pIp, const USHORT nPort);
#endif
UINT GetCount(bool bDoLock = true);
};
#endif // #if defined(_SERVER)