Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
548
Server/AdminTool/AdminToolServer/RYL_AgentServerTable.cpp
Normal file
548
Server/AdminTool/AdminToolServer/RYL_AgentServerTable.cpp
Normal file
@@ -0,0 +1,548 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "RYL_AgentServerTable.h"
|
||||
#include "RYL_AgentServerDispatch.h"
|
||||
|
||||
#include <DBComponent/RYL_GameDB.h>
|
||||
#include <DBComponent/BillingDB.h>
|
||||
#include <DBComponent/AuthDB.h>
|
||||
|
||||
#include <Network/IOCP/IOCPNet.h>
|
||||
#include <Network/Session/Session.h>
|
||||
#include <Network/Session/CreatePolicy.h>
|
||||
|
||||
#include <Parser/ServerInfo.h>
|
||||
#include <Log/ServerLog.h>
|
||||
|
||||
|
||||
CAgentServerTable::CAgentServerTable()
|
||||
{
|
||||
Destroy(); // <20>ʱ<EFBFBD>ȭ <20><><EFBFBD><EFBFBD>
|
||||
|
||||
m_lpSessionPolicy = SessionPolicy::CreateTCPPolicy<CRylAgentServerDispatch>();
|
||||
|
||||
const char* szNation = CServerInfo::GetInstance().GetValue("NATION");
|
||||
if (NULL != szNation)
|
||||
{
|
||||
strncpy(m_szNation , szNation, MAX_BUFFER);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ÿ<><C5B8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>дµ<D0B4> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.(<28>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NATION<4F><4E><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD>Ͻʽÿ<CABD>)");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
CAgentServerTable::~CAgentServerTable()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void CAgentServerTable::Destroy()
|
||||
{
|
||||
// AgentServer Dispatch <20><> <20><><EFBFBD><EFBFBD> NULL<4C><4C> ä<><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
m_IPtoServerID.clear();
|
||||
|
||||
// GameDB <20><>ü <20><><EFBFBD><EFBFBD> <20>Ҹ<EFBFBD>
|
||||
CGameDB** DBfirst = m_lpGameDB;
|
||||
CGameDB** DBlast = m_lpGameDB + MAX_AGENT_SERVER;
|
||||
|
||||
for(; DBfirst != DBlast; ++DBfirst)
|
||||
{
|
||||
CGameDB* lpGameDB = *DBfirst;
|
||||
|
||||
if(lpGameDB != NULL)
|
||||
{
|
||||
delete lpGameDB;
|
||||
}
|
||||
}
|
||||
|
||||
std::fill_n(m_lpGameDB, int(MAX_AGENT_SERVER), reinterpret_cast<CGameDB*>(NULL));
|
||||
|
||||
if (NULL != m_lpBillingDB)
|
||||
{
|
||||
delete m_lpBillingDB;
|
||||
m_lpBillingDB = NULL;
|
||||
}
|
||||
|
||||
if (NULL != m_lpBillingLogDB)
|
||||
{
|
||||
delete m_lpBillingLogDB;
|
||||
m_lpBillingLogDB = NULL;
|
||||
}
|
||||
|
||||
if (NULL != m_lpAuthDB)
|
||||
{
|
||||
delete m_lpAuthDB;
|
||||
m_lpAuthDB = NULL;
|
||||
}
|
||||
|
||||
if(NULL != m_lpSessionPolicy)
|
||||
{
|
||||
delete m_lpSessionPolicy;
|
||||
m_lpSessionPolicy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::InitAgentServerTable(CIOCPNet& IOCPNetwork)
|
||||
{
|
||||
ConnectToAllAgentServerz(IOCPNetwork);
|
||||
|
||||
ConnectToBillingDB();
|
||||
ConnectToAuthDB();
|
||||
|
||||
if (0 == strcmp(m_szNation, "KOREA"))
|
||||
{
|
||||
ConnectToBillingLogDB();
|
||||
}
|
||||
}
|
||||
|
||||
CGameDB* CAgentServerTable::GetGameDB(unsigned long dwServerID)
|
||||
{
|
||||
if (dwServerID < MAX_AGENT_SERVER)
|
||||
{
|
||||
if (m_lpGameDB[dwServerID] != NULL)
|
||||
{
|
||||
return m_lpGameDB[dwServerID];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CSession* CAgentServerTable::GetSession(unsigned long dwServerID)
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpAgentDispatch, dwServerID,
|
||||
CRylAgentServerDispatch, CRylAgentServerDispatch::GetDispatchTable());
|
||||
|
||||
if(NULL != lpAgentDispatch)
|
||||
{
|
||||
return &lpAgentDispatch->GetSession();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CServerRequestKeeper& CAgentServerTable::GetRequestKeeper(unsigned long dwServerGroup)
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpAgentDispatch, dwServerGroup,
|
||||
CRylAgentServerDispatch, CRylAgentServerDispatch::GetDispatchTable());
|
||||
|
||||
return lpAgentDispatch->GetRequestKeeper();
|
||||
}
|
||||
|
||||
CRylAgentServerDispatch* CAgentServerTable::GetDispatch(unsigned long dwServerID)
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpAgentDispatch, dwServerID,
|
||||
CRylAgentServerDispatch, CRylAgentServerDispatch::GetDispatchTable());
|
||||
|
||||
return lpAgentDispatch;
|
||||
}
|
||||
|
||||
void CAgentServerTable::RemoveAllModifyCharacter(CPacketDispatch* lpPacketDispatch)
|
||||
{
|
||||
for(int cnt = 0; cnt < MAX_AGENT_SERVER; cnt++)
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpAgentDispatch,
|
||||
cnt, CRylAgentServerDispatch, CRylAgentServerDispatch::GetDispatchTable());
|
||||
|
||||
if(NULL != lpAgentDispatch)
|
||||
{
|
||||
lpAgentDispatch->GetModifyCharacterMgr().AllRemoveChar(lpPacketDispatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::RemoveAllDepositLock(CPacketDispatch* lpPacketDispatch)
|
||||
{
|
||||
for(int cnt = 0; cnt < MAX_AGENT_SERVER; cnt++)
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpAgentDispatch,
|
||||
cnt, CRylAgentServerDispatch, CRylAgentServerDispatch::GetDispatchTable());
|
||||
|
||||
if(NULL != lpAgentDispatch)
|
||||
{
|
||||
lpAgentDispatch->GetDepositLock().RemoveAllSelectDispatch(lpPacketDispatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::ConnectToAgentServer(CIOCPNet& IOCPNetwork, unsigned long dwServerGroup)
|
||||
{
|
||||
DBAgentServerInfo stServerInfo;
|
||||
|
||||
if (GetAgentServerInfo(dwServerGroup, stServerInfo))
|
||||
{
|
||||
m_IPtoServerID[inet_addr(stServerInfo.szServerAddress)] = dwServerGroup;
|
||||
|
||||
GET_MULTI_DISPATCH(lpAgentDispatch, dwServerGroup,
|
||||
CRylAgentServerDispatch, CRylAgentServerDispatch::GetDispatchTable());
|
||||
|
||||
if ((NULL == lpAgentDispatch) || (!lpAgentDispatch->GetSession().IsConnected()))
|
||||
{
|
||||
if(!IOCPNetwork.Connect(m_lpSessionPolicy,
|
||||
stServerInfo.szServerAddress, CServerSetup::DBAgentAdminToolServerListen))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. IP: %s/Port: %d",
|
||||
stServerInfo.szServerAddress, CServerSetup::DBAgentAdminToolServerListen);
|
||||
}
|
||||
}
|
||||
|
||||
CGameDB* lpDBComponent = new CGameDB;
|
||||
|
||||
if (lpDBComponent->Connect(stServerInfo.szDBServer, stServerInfo.szDBName,
|
||||
stServerInfo.szDBAccount, stServerInfo.szDBPass))
|
||||
{
|
||||
m_lpGameDB[dwServerGroup] = lpDBComponent;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete lpDBComponent;
|
||||
ERRLOG4(g_Log, "DB <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. IP: %s/DBName: %s/DBAccount: %s/DBPass: %s",
|
||||
stServerInfo.szDBServer, stServerInfo.szDBName,
|
||||
stServerInfo.szDBAccount, stServerInfo.szDBPass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::ConnectToBillingDB()
|
||||
{
|
||||
char szErrMessage[1024];
|
||||
CServerInfo& ServerInfoTXT = CServerInfo::GetInstance();
|
||||
|
||||
if(!ServerInfoTXT.Reload())
|
||||
{
|
||||
_snprintf(szErrMessage, sizeof(szErrMessage),
|
||||
"Failed To Load Server Script : Filename- %s", ServerInfoTXT.GetFileName());
|
||||
MessageBox(NULL, szErrMessage, "Err", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
char szBillingDBServerBuffer[MAX_BUFFER];
|
||||
char szBillingDBNameBuffer[MAX_BUFFER];
|
||||
char szBillingDBAccountBuffer[MAX_BUFFER];
|
||||
char szBillingDBPassBuffer[MAX_BUFFER];
|
||||
|
||||
const char* szBillingServer = ServerInfoTXT.GetValue("BILLING_DB_IP");
|
||||
const char* szBillingName = ServerInfoTXT.GetValue("BILLING_DB_NAME");
|
||||
const char* szBillingAccount = ServerInfoTXT.GetValue("BILLING_DB_ACCOUNT");
|
||||
const char* szBillingPass = ServerInfoTXT.GetValue("BILLING_DB_PASS");
|
||||
|
||||
strncpy(szBillingDBServerBuffer, szBillingServer, MAX_BUFFER);
|
||||
strncpy(szBillingDBNameBuffer, szBillingName, MAX_BUFFER);
|
||||
strncpy(szBillingDBAccountBuffer, szBillingAccount, MAX_BUFFER);
|
||||
strncpy(szBillingDBPassBuffer, szBillingPass, MAX_BUFFER);
|
||||
|
||||
szBillingDBServerBuffer[MAX_BUFFER - 1] = 0;
|
||||
szBillingDBNameBuffer[MAX_BUFFER - 1] = 0;
|
||||
szBillingDBAccountBuffer[MAX_BUFFER - 1] = 0;
|
||||
szBillingDBPassBuffer[MAX_BUFFER - 1] = 0;
|
||||
|
||||
CBillingDB* lpBillingDB = new CBillingDB;
|
||||
|
||||
if(lpBillingDB->ConnectSQLServer(szBillingDBServerBuffer, szBillingDBNameBuffer,
|
||||
szBillingDBAccountBuffer, szBillingDBPassBuffer, OleDB::ConnType_MSSQL))
|
||||
{
|
||||
m_lpBillingDB = lpBillingDB;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERRLOG4(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. IP: %s/DBName: %s/DBAccount: %s/DBPass: %s",
|
||||
szBillingDBServerBuffer, szBillingDBNameBuffer,
|
||||
szBillingDBAccountBuffer, szBillingDBPassBuffer);
|
||||
|
||||
m_lpBillingDB = NULL;
|
||||
|
||||
delete lpBillingDB;
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::ConnectToBillingLogDB()
|
||||
{
|
||||
char szErrMessage[1024];
|
||||
CServerInfo& ServerInfoTXT = CServerInfo::GetInstance();
|
||||
|
||||
if(!ServerInfoTXT.Reload())
|
||||
{
|
||||
_snprintf(szErrMessage, sizeof(szErrMessage),
|
||||
"Failed To Load Server Script : Filename- %s", ServerInfoTXT.GetFileName());
|
||||
MessageBox(NULL, szErrMessage, "Err", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
char szBillingDBServerBuffer[MAX_BUFFER];
|
||||
char szBillingDBNameBuffer[MAX_BUFFER];
|
||||
char szBillingDBAccountBuffer[MAX_BUFFER];
|
||||
char szBillingDBPassBuffer[MAX_BUFFER];
|
||||
|
||||
const char* szBillingServer = ServerInfoTXT.GetValue("BILLING_LOG_DB_IP");
|
||||
const char* szBillingName = ServerInfoTXT.GetValue("BILLING_LOG_DB_NAME");
|
||||
const char* szBillingAccount = ServerInfoTXT.GetValue("BILLING_LOG_DB_ACCOUNT");
|
||||
const char* szBillingPass = ServerInfoTXT.GetValue("BILLING_LOG_DB_PASS");
|
||||
|
||||
strncpy(szBillingDBServerBuffer, szBillingServer, MAX_BUFFER);
|
||||
strncpy(szBillingDBNameBuffer, szBillingName, MAX_BUFFER);
|
||||
strncpy(szBillingDBAccountBuffer, szBillingAccount, MAX_BUFFER);
|
||||
strncpy(szBillingDBPassBuffer, szBillingPass, MAX_BUFFER);
|
||||
|
||||
szBillingDBServerBuffer[MAX_BUFFER - 1] = 0;
|
||||
szBillingDBNameBuffer[MAX_BUFFER - 1] = 0;
|
||||
szBillingDBAccountBuffer[MAX_BUFFER - 1] = 0;
|
||||
szBillingDBPassBuffer[MAX_BUFFER - 1] = 0;
|
||||
|
||||
CBillingDB* lpBillingDB = new CBillingDB;
|
||||
|
||||
if(lpBillingDB->ConnectSQLServer(szBillingDBServerBuffer, szBillingDBNameBuffer,
|
||||
szBillingDBAccountBuffer, szBillingDBPassBuffer, OleDB::ConnType_MSSQL))
|
||||
{
|
||||
m_lpBillingLogDB = lpBillingDB;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERRLOG4(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. IP: %s/DBName: %s/DBAccount: %s/DBPass: %s",
|
||||
szBillingDBServerBuffer, szBillingDBNameBuffer,
|
||||
szBillingDBAccountBuffer, szBillingDBPassBuffer);
|
||||
|
||||
m_lpBillingLogDB = NULL;
|
||||
|
||||
delete lpBillingDB;
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::ConnectToAuthDB()
|
||||
{
|
||||
char szErrMessage[1024];
|
||||
CServerInfo& ServerInfoTXT = CServerInfo::GetInstance();
|
||||
|
||||
if(!ServerInfoTXT.Reload())
|
||||
{
|
||||
_snprintf(szErrMessage, sizeof(szErrMessage),
|
||||
"Failed To Load Server Script : Filename- %s", ServerInfoTXT.GetFileName());
|
||||
MessageBox(NULL, szErrMessage, "Err", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
char szAuthDBServerBuffer[MAX_BUFFER];
|
||||
char szAuthDBNameBuffer[MAX_BUFFER];
|
||||
char szAuthDBAccountBuffer[MAX_BUFFER];
|
||||
char szAuthDBPassBuffer[MAX_BUFFER];
|
||||
|
||||
const char* szAuthDBAddr = ServerInfoTXT.GetValue("AUTH_DB_IP");
|
||||
const char* szAuthDBName = ServerInfoTXT.GetValue("AUTH_DB_NAME");
|
||||
const char* szAuthDBAccount = ServerInfoTXT.GetValue("AUTH_DB_ACCOUNT");
|
||||
const char* szAuthDBPass = ServerInfoTXT.GetValue("AUTH_DB_PASS");
|
||||
|
||||
strncpy(szAuthDBServerBuffer, szAuthDBAddr, MAX_BUFFER);
|
||||
strncpy(szAuthDBNameBuffer, szAuthDBName, MAX_BUFFER);
|
||||
strncpy(szAuthDBAccountBuffer, szAuthDBAccount, MAX_BUFFER);
|
||||
strncpy(szAuthDBPassBuffer, szAuthDBPass, MAX_BUFFER);
|
||||
|
||||
szAuthDBServerBuffer[MAX_BUFFER - 1] = 0;
|
||||
szAuthDBNameBuffer[MAX_BUFFER - 1] = 0;
|
||||
szAuthDBAccountBuffer[MAX_BUFFER - 1] = 0;
|
||||
szAuthDBPassBuffer[MAX_BUFFER - 1] = 0;
|
||||
|
||||
CAuthDB* lpAuthDB = new CAuthDB;
|
||||
|
||||
if (true == lpAuthDB->ConnectSQLServer(szAuthDBServerBuffer,
|
||||
szAuthDBNameBuffer, szAuthDBAccountBuffer, szAuthDBPassBuffer, OleDB::ConnType_MSSQL))
|
||||
{
|
||||
m_lpAuthDB = lpAuthDB;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERRLOG4(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. IP: %s/DBName: %s/DBAccount: %s/DBPass: %s",
|
||||
szAuthDBServerBuffer, szAuthDBNameBuffer,
|
||||
szAuthDBAccountBuffer, szAuthDBPassBuffer);
|
||||
|
||||
m_lpAuthDB = NULL;
|
||||
|
||||
delete lpAuthDB;
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::ConnectToAllAgentServerz(CIOCPNet& IOCPNetwork)
|
||||
{
|
||||
for(unsigned long dwServerGroup = 0; dwServerGroup < MAX_AGENT_SERVER; ++dwServerGroup)
|
||||
{
|
||||
ConnectToAgentServer(IOCPNetwork, dwServerGroup);
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::PrintServerState(char* szText, int length)
|
||||
{
|
||||
const int MAX_BUFFER = 256;
|
||||
int nLength = 0;
|
||||
|
||||
char szServerNameBuffer[MAX_BUFFER]; // <20><EFBFBD> <20><>
|
||||
char szServerAddressBuffer[MAX_BUFFER]; // <20>߰輭<DFB0><E8BCAD> IP
|
||||
char szDBNameBuffer[MAX_BUFFER]; // <20><><EFBFBD><EFBFBD> <20><>
|
||||
|
||||
CServerInfo& ServerInfoTXT = CServerInfo::GetInstance();
|
||||
|
||||
nLength += _snprintf(szText + nLength, length - nLength, ">> NationType: %s\r\n", m_szNation);
|
||||
|
||||
nLength += _snprintf(szText + nLength, length - nLength, ">> DBAgentServer Connection State: \r\n");
|
||||
|
||||
for (unsigned long dwServerGroup = 0; dwServerGroup < MAX_AGENT_SERVER; ++dwServerGroup)
|
||||
{
|
||||
_snprintf(szServerNameBuffer, MAX_BUFFER, "SERVERGROUP_NAME_%02u", dwServerGroup);
|
||||
_snprintf(szServerAddressBuffer, MAX_BUFFER, "AGENTSERVER_IP_%02u", dwServerGroup);
|
||||
_snprintf(szDBNameBuffer, MAX_BUFFER, "GAME_DB_NAME_%02u", dwServerGroup);
|
||||
|
||||
const char* szServerName = ServerInfoTXT.GetValue(szServerNameBuffer);
|
||||
const char* szServerAddress = ServerInfoTXT.GetValue(szServerAddressBuffer);
|
||||
const char* szDBName = ServerInfoTXT.GetValue(szDBNameBuffer);
|
||||
|
||||
if((szServerName != NULL) && (szServerAddress != NULL) && (szDBName))
|
||||
{
|
||||
strncpy(szServerNameBuffer, szServerName, MAX_BUFFER);
|
||||
strncpy(szServerAddressBuffer, szServerAddress,MAX_BUFFER);
|
||||
strncpy(szDBNameBuffer, szDBName, MAX_BUFFER);
|
||||
|
||||
szServerNameBuffer[MAX_BUFFER - 1] = 0;
|
||||
szServerAddressBuffer[MAX_BUFFER - 1] = 0;
|
||||
szDBNameBuffer[MAX_BUFFER - 1] = 0;
|
||||
|
||||
GET_MULTI_DISPATCH(lpAgentDispatch, dwServerGroup,
|
||||
CRylAgentServerDispatch, CRylAgentServerDispatch::GetDispatchTable());
|
||||
|
||||
CGameDB* lpGameDB = m_lpGameDB[dwServerGroup];
|
||||
|
||||
nLength += _snprintf(szText + nLength, length - nLength,
|
||||
"[%02u] %15s : ", dwServerGroup, szServerNameBuffer);
|
||||
|
||||
if(NULL != lpAgentDispatch)
|
||||
{
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "DBAgent Connected");
|
||||
}
|
||||
else
|
||||
{
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "DBAgent Disconnected");
|
||||
}
|
||||
if(NULL != lpGameDB)
|
||||
{
|
||||
nLength += _snprintf(szText + nLength, length - nLength, " (DB Connected)\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
nLength += _snprintf(szText + nLength, length - nLength, " (DB Disconnected)\r\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// <20>ѱ<EFBFBD>, <20>ؿ<EFBFBD><D8BF><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD> <20>ϴ<EFBFBD> <20><>Ÿ DB <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٸ<EFBFBD>.
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "\r\n>> ETC Connection State: \r\n");
|
||||
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "BillingDB Connection State:\t");
|
||||
|
||||
if(NULL != m_lpBillingDB)
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "Connected\r\n");
|
||||
else
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "Disconnected\r\n");
|
||||
|
||||
if (0 == strcmp(m_szNation, "KOREA"))
|
||||
{
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "BillingLogDB Connection State:\t");
|
||||
|
||||
if(NULL != m_lpBillingLogDB)
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "Connected");
|
||||
else
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "Disconnected");
|
||||
}
|
||||
else
|
||||
{
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "AuthDB Connection State:\t");
|
||||
|
||||
if(NULL != m_lpAuthDB)
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "Connected\r\n");
|
||||
else
|
||||
nLength += _snprintf(szText + nLength, length - nLength, "Disconnected\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
void CAgentServerTable::Disconnected(unsigned long dwIP)
|
||||
{
|
||||
m_IPtoServerID.erase(dwIP);
|
||||
}
|
||||
|
||||
unsigned long CAgentServerTable::GetGroupFromDBAgentIP(unsigned long dwIP)
|
||||
{
|
||||
IPtoServerID::iterator pos = m_IPtoServerID.find(dwIP);
|
||||
|
||||
if(pos != m_IPtoServerID.end())
|
||||
{
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
return MAX_AGENT_SERVER;
|
||||
}
|
||||
|
||||
bool CAgentServerTable::GetAgentServerInfo(unsigned long dwGroupIndex,
|
||||
DBAgentServerInfo& stAgentServerInfo)
|
||||
{
|
||||
char szErrMessage[1024];
|
||||
CServerInfo& ServerInfoTXT = CServerInfo::GetInstance();
|
||||
|
||||
if(!ServerInfoTXT.Reload())
|
||||
{
|
||||
_snprintf(szErrMessage, sizeof(szErrMessage),
|
||||
"Failed To Load Server Script : Filename- %s", ServerInfoTXT.GetFileName());
|
||||
|
||||
MessageBox(NULL, szErrMessage, "Err", MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
char szServerNameKey[MAX_BUFFER]; // <20>ش<EFBFBD> <20><EFBFBD><D7B7><EFBFBD>
|
||||
char szServerAddressKey[MAX_BUFFER]; // <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> IP
|
||||
char szDBServerKey[MAX_BUFFER]; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> IP
|
||||
char szDBNameKey[MAX_BUFFER]; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>
|
||||
char szDBAccountKey[MAX_BUFFER]; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
char szDBPassKey[MAX_BUFFER]; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
_snprintf(szServerNameKey, MAX_BUFFER, "SERVERGROUP_NAME_%02u", dwGroupIndex);
|
||||
_snprintf(szServerAddressKey, MAX_BUFFER, "AGENTSERVER_IP_%02u", dwGroupIndex);
|
||||
_snprintf(szDBServerKey, MAX_BUFFER, "GAME_DB_IP_%02u", dwGroupIndex);
|
||||
_snprintf(szDBNameKey, MAX_BUFFER, "GAME_DB_NAME_%02u", dwGroupIndex);
|
||||
_snprintf(szDBAccountKey, MAX_BUFFER, "GAME_DB_ACCOUNT_%02u", dwGroupIndex);
|
||||
_snprintf(szDBPassKey, MAX_BUFFER, "GAME_DB_PASS_%02u", dwGroupIndex);
|
||||
|
||||
const char* szServerNameBuffer = ServerInfoTXT.GetValue(szServerNameKey);
|
||||
const char* szServerAddressBuffer = ServerInfoTXT.GetValue(szServerAddressKey);
|
||||
const char* szDBServerBuffer = ServerInfoTXT.GetValue(szDBServerKey);
|
||||
const char* szDBNameBuffer = ServerInfoTXT.GetValue(szDBNameKey);
|
||||
const char* szDBAccountBuffer = ServerInfoTXT.GetValue(szDBAccountKey);
|
||||
const char* szDBPassBuffer = ServerInfoTXT.GetValue(szDBPassKey);
|
||||
|
||||
if(szServerNameBuffer && szServerAddressBuffer
|
||||
&& szDBServerBuffer && szDBNameBuffer
|
||||
&& szDBAccountBuffer && szDBPassBuffer)
|
||||
{
|
||||
strncpy(stAgentServerInfo.szServerName, szServerNameBuffer, MAX_BUFFER);
|
||||
strncpy(stAgentServerInfo.szServerAddress, szServerAddressBuffer, MAX_BUFFER);
|
||||
strncpy(stAgentServerInfo.szDBServer, szDBServerBuffer, MAX_BUFFER);
|
||||
strncpy(stAgentServerInfo.szDBName, szDBNameBuffer, MAX_BUFFER);
|
||||
strncpy(stAgentServerInfo.szDBAccount, szDBAccountBuffer, MAX_BUFFER);
|
||||
strncpy(stAgentServerInfo.szDBPass, szDBPassBuffer, MAX_BUFFER);
|
||||
|
||||
stAgentServerInfo.szServerName[MAX_BUFFER - 1] = 0;
|
||||
stAgentServerInfo.szServerAddress[MAX_BUFFER - 1] = 0;
|
||||
stAgentServerInfo.szDBServer[MAX_BUFFER - 1] = 0;
|
||||
stAgentServerInfo.szDBName[MAX_BUFFER - 1] = 0;
|
||||
stAgentServerInfo.szDBAccount[MAX_BUFFER - 1] = 0;
|
||||
stAgentServerInfo.szDBPass[MAX_BUFFER - 1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CAgentServerTable::SetNULL(unsigned long dwServerGroup)
|
||||
{
|
||||
//m_lpAgentServerDispatch[dwServerGroup] = NULL;
|
||||
}
|
||||
Reference in New Issue
Block a user