DragonNest/Common/NetworkLib/ConnectionManager.h
Cussrro 47f7895977 Revert "修复编码问题"
This reverts commit 9e69c01767.
2024-12-21 10:04:04 +08:00

52 lines
No EOL
1.2 KiB
C++

#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)