Files
mir_server/server/LogicServer/commonserver/CommonServer.h

62 lines
2.6 KiB
C
Raw Normal View History

2025-01-09 17:45:40 +08:00
#ifndef COMMON_SERVER_H_
#define COMMON_SERVER_H_
/*
Server类
CCommonServerClient类负责和客户端的连接处理CCommonServer只是负责连接的建立和管理
ServerIndex来进行索引
ServerIndex索引每次都需要遍历
CCommonServer::SendData(serverIndex, pData, nLen)
CCommonServerClient里头处理
*/
class CCommonServerClient;
class CCommonServer : public CCustomServerSocket
{
public:
typedef CCustomServerSocket Inherited;
CCommonServer();
~CCommonServer();
//覆盖创建连接对象的函数
CCustomServerClientSocket* CreateClientSocket(SOCKET nSocket, PSOCKADDR_IN pAddrIn);
//覆盖销毁一个已经建立的客户端对象
VOID DestroyClientSocket(CCustomServerClientSocket *pClientSocket);
//覆盖处理客户端连接的函数
VOID ProcessClients();
//覆盖内部消息分派函数
VOID DispatchInternalMessage(UINT uMsg, UINT64 uParam1, UINT64 uParam2, UINT64 uParam3,UINT64 uParam4);
//覆盖例行执行函数
VOID SingleRun();
//覆盖父类调用例行RUN的函数
VOID OnRun();
/*
* Comments: 线81960
* Param int nServerIndex: ServerIndex
* Param const char * pData:
* Param const size_t nLen:
* @Return void:
* @Remark: TODO
*/
void SendData(int nServerIndex, const void *pData, const size_t nLen);
private:
//处理已经关闭的数据客户端对象
VOID ProcessClosedClients();
//// 供外部线程调用,需要加锁
//BOOL GetSession(const INT_PTR nSessionId, OUT PGAMESESSION pSession);
//// 供内部调用,无需加锁
//PGAMESESSION GetSessionPtr(const INT_PTR nSessionId, PINT_PTR lpIndex);
private:
//CBaseList<CCommonServerClient*> m_CloseClientList; //已经关闭的数据客户端列表
/*CQueueList<PGAMESESSION> m_SessionList;
CCSLock m_SessionListLock;*/
};
#endif