Sfoglia il codice sorgente

1:增加从LogonServer读取协调存储在redis中的信息测试代码

dev
homeremote 5 anni fa
parent
commit
f5e4b61bf8
3 ha cambiato i file con 20 aggiunte e 1 eliminazioni
  1. BIN
      俱乐部/Bin/Debug_Unicode/ServerParameter.ini
  2. +1
    -1
      俱乐部/Source/ServerControl/CorrespondServer/AttemperEngineSink.cpp
  3. +19
    -0
      俱乐部/Source/ServerControl/LogonServer/AttemperEngineSink.cpp

BIN
俱乐部/Bin/Debug_Unicode/ServerParameter.ini Vedi File


+ 1
- 1
俱乐部/Source/ServerControl/CorrespondServer/AttemperEngineSink.cpp Vedi File

@@ -1035,7 +1035,7 @@ bool CAttemperEngineSink::OnTCPNetworkMainServiceInfo(WORD wSubCmdID, VOID * pDa
m_pITCPNetworkEngine->SendDataBatch(MDM_CS_SERVICE_INFO, SUB_CS_S_SERVER_ONLINE, &ServerOnLine, sizeof(ServerOnLine), 0L);
//存储信息到redis
//测试存储信息到redis
std::vector<std::pair<std::string, std::string>> field_val;
field_val.push_back({ "wServerID", string_format("%d",ServerOnLine.wServerID) });
field_val.push_back({ "dwOnLineCount", string_format("%d",ServerOnLine.dwOnLineCount) });


+ 19
- 0
俱乐部/Source/ServerControl/LogonServer/AttemperEngineSink.cpp Vedi File

@@ -875,6 +875,25 @@ bool CAttemperEngineSink::OnTCPSocketMainServiceInfo(WORD wSubCmdID, VOID * pDat
//±äÁ¿¶¨Òå
CMD_CS_S_ServerOnLine * pServerOnLine = (CMD_CS_S_ServerOnLine *)pData;
//²âÊÔ´Óreids¶ÁÈ¡
//hmget
std::vector<std::string> filelds{ "wServerID","dwOnLineCount" };
//hmget
m_RedisClient->GetRedisClient()->hmget(string_format("Server_Info:%d", pServerOnLine->wServerID), filelds, [](cpp_redis::reply& reply) {
for (auto& res : reply.as_array())
{
std::cout << res.as_string() << std::endl;
}
});
//hgetall
m_RedisClient->GetRedisClient()->hgetall(string_format("Server_Info:%d", pServerOnLine->wServerID), [](const cpp_redis::reply& reply) {
for (auto& res : reply.as_array())
{
//std::cout << res << std::endl;
std::cout << res.as_string() << std::endl;
}
});
//²éÕÒ·¿¼ä
CGameServerItem * pGameServerItem = m_ServerListManager.SearchGameServer(pServerOnLine->wServerID);
if (pGameServerItem == NULL) return true;


Caricamento…
Annulla
Salva