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:
@@ -0,0 +1,87 @@
|
||||
#include "stdafx.h"
|
||||
#include "CheckPing.h"
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
|
||||
CCheckPing::CCheckPing()
|
||||
: m_dwLastPingRecvTime(0), m_dwPingCount(0), m_dwFirstCheckTime(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CCheckPing::CheckPing(unsigned long dwCurrentTime)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> üũ<C3BC><C5A9> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD>.
|
||||
if (false == CServerSetup::GetInstance().GetPingCheck())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><> <20>м<EFBFBD>
|
||||
CheckPingLock::Syncronize sync(m_PingLock);
|
||||
|
||||
if (0 == m_dwLastPingRecvTime && 0 == m_dwPingCount)
|
||||
{
|
||||
if (0 == m_dwFirstCheckTime)
|
||||
{
|
||||
m_dwFirstCheckTime = dwCurrentTime;
|
||||
|
||||
if (0 == m_dwFirstCheckTime)
|
||||
{
|
||||
++m_dwFirstCheckTime;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 10<31><30> * 30. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 300<30><30>(5<><35>) <20><><EFBFBD><EFBFBD> <20><> <20><>Ŷ<EFBFBD><C5B6> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
|
||||
LONG nFirstDifference = dwCurrentTime - m_dwFirstCheckTime;
|
||||
if (PING_INTERVAL * 30 < nFirstDifference)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
LONG nDifference = dwCurrentTime - m_dwLastPingRecvTime;
|
||||
return (nDifference < PING_INTERVAL * 60) ? true : false;
|
||||
}
|
||||
|
||||
void CCheckPing::SetLastPingRecvTime(unsigned long dwCurrentTime)
|
||||
{
|
||||
CheckPingLock::Syncronize sync(m_PingLock);
|
||||
|
||||
m_dwLastPingRecvTime = dwCurrentTime;
|
||||
++m_dwPingCount;
|
||||
|
||||
if (0 == m_dwPingCount)
|
||||
{
|
||||
++m_dwPingCount;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long CCheckPing::GetLastPingRecvTime()
|
||||
{
|
||||
CheckPingLock::Syncronize sync(m_PingLock);
|
||||
return m_dwLastPingRecvTime;
|
||||
}
|
||||
|
||||
unsigned long CCheckPing::GetPingCount()
|
||||
{
|
||||
CheckPingLock::Syncronize sync(m_PingLock);
|
||||
return m_dwPingCount;
|
||||
}
|
||||
|
||||
|
||||
void CCheckPing::GetPingData(unsigned long& dwPingCount,
|
||||
unsigned long& dwLastPingRecvTime,
|
||||
unsigned long& dwFirstCheckTime)
|
||||
{
|
||||
CheckPingLock::Syncronize sync(m_PingLock);
|
||||
|
||||
dwPingCount = m_dwPingCount;
|
||||
dwLastPingRecvTime = m_dwLastPingRecvTime;
|
||||
dwFirstCheckTime = m_dwFirstCheckTime;
|
||||
}
|
||||
Reference in New Issue
Block a user