mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix bug, increase dump_log max seconds to 10min
This commit is contained in:
parent
aa817a810b
commit
7f100e2620
|
@ -831,9 +831,11 @@ void CGameContext::ConDumpLog(IConsole::IResult *pResult, void *pUserData)
|
|||
if(LimitSecs < 0)
|
||||
return;
|
||||
|
||||
for(int i = pSelf->m_FirstLog; i != pSelf->m_LastLog; i = (i + 1) % pSelf->MAX_LOGS)
|
||||
int Iterator = pSelf->m_LatestLog;
|
||||
for(int i = 0; i < MAX_LOGS; i++)
|
||||
{
|
||||
CLog *pEntry = &pSelf->m_aLogs[i];
|
||||
CLog *pEntry = &pSelf->m_aLogs[Iterator];
|
||||
Iterator = (Iterator + 1) % MAX_LOGS;
|
||||
|
||||
if(!pEntry->m_Timestamp)
|
||||
continue;
|
||||
|
@ -854,10 +856,8 @@ void CGameContext::ConDumpLog(IConsole::IResult *pResult, void *pUserData)
|
|||
|
||||
void CGameContext::LogEvent(const char *Description, int ClientID)
|
||||
{
|
||||
CLog *pNewEntry = &m_aLogs[m_LastLog];
|
||||
m_LastLog = (m_LastLog + 1) % MAX_LOGS;
|
||||
if(m_LastLog == m_FirstLog)
|
||||
m_FirstLog++;
|
||||
CLog *pNewEntry = &m_aLogs[m_LatestLog];
|
||||
m_LatestLog = (m_LatestLog + 1) % MAX_LOGS;
|
||||
|
||||
pNewEntry->m_Timestamp = time_get();
|
||||
str_copy(pNewEntry->m_aDescription, Description);
|
||||
|
|
|
@ -94,8 +94,8 @@ void CGameContext::Construct(int Resetting)
|
|||
m_NumMutes = 0;
|
||||
m_NumVoteMutes = 0;
|
||||
|
||||
m_LastLog = 0;
|
||||
m_FirstLog = 0;
|
||||
m_LatestLog = 0;
|
||||
mem_zero(&m_aLogs, sizeof(m_aLogs));
|
||||
|
||||
if(Resetting == NO_RESET)
|
||||
{
|
||||
|
@ -1150,14 +1150,6 @@ void CGameContext::OnTick()
|
|||
m_aVoteMutes[i] = m_aVoteMutes[m_NumVoteMutes];
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < m_LastLog; i++)
|
||||
{
|
||||
if(m_aLogs[i].m_Timestamp && (time_get() - m_aLogs[i].m_Timestamp) / time_freq() > MAX_LOG_SECONDS)
|
||||
{
|
||||
m_FirstLog = (m_FirstLog + 1) % MAX_LOGS;
|
||||
m_aLogs[m_FirstLog].m_Timestamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(Server()->Tick() % (g_Config.m_SvAnnouncementInterval * Server()->TickSpeed() * 60) == 0)
|
||||
{
|
||||
|
|
|
@ -475,8 +475,8 @@ private:
|
|||
|
||||
enum
|
||||
{
|
||||
MAX_LOG_SECONDS = 240,
|
||||
MAX_LOGS = 256,
|
||||
MAX_LOG_SECONDS = 600,
|
||||
MAX_LOGS = 512,
|
||||
};
|
||||
struct CLog
|
||||
{
|
||||
|
@ -488,8 +488,7 @@ private:
|
|||
char m_aClientAddrStr[NETADDR_MAXSTRSIZE];
|
||||
};
|
||||
CLog m_aLogs[MAX_LOGS];
|
||||
int m_FirstLog;
|
||||
int m_LastLog;
|
||||
int m_LatestLog;
|
||||
|
||||
void LogEvent(const char *Description, int ClientID);
|
||||
|
||||
|
|
Loading…
Reference in a new issue