Disable timeout for 0.7 clients

This commit is contained in:
Learath 2020-06-20 19:50:14 +03:00
parent 17e77d73bb
commit 28905c4659
5 changed files with 25 additions and 11 deletions

View file

@ -3589,6 +3589,8 @@ bool CServer::SetTimedOut(int ClientID, int OrigID)
{
return false;
}
m_aClients[ClientID].m_Sixup = m_aClients[OrigID].m_Sixup;
DelClientCallback(OrigID, "Timeout Protection used", this);
m_aClients[ClientID].m_Authed = AUTHED_NO;
m_aClients[ClientID].m_Flags = m_aClients[OrigID].m_Flags;

View file

@ -234,7 +234,7 @@ public:
int SecurityToken() const { return m_SecurityToken; }
TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *ResendBuffer() { return &m_Buffer; };
void SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer);
void SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer, bool Sixup);
// anti spoof
void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup);

View file

@ -472,7 +472,7 @@ int CNetConnection::Update()
return 0;
}
void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer)
void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer, bool Sixup)
{
int64 Now = time_get();
@ -487,6 +487,7 @@ void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SE
m_LastRecvTime = Now;
m_LastUpdateTime = Now;
m_SecurityToken = SecurityToken;
m_Sixup = Sixup;
// copy resend buffer
m_Buffer.Init();

View file

@ -813,7 +813,7 @@ bool CNetServer::SetTimedOut(int ClientID, int OrigID)
if (m_aSlots[ClientID].m_Connection.State() != NET_CONNSTATE_ERROR)
return false;
m_aSlots[ClientID].m_Connection.SetTimedOut(ClientAddr(OrigID), m_aSlots[OrigID].m_Connection.SeqSequence(), m_aSlots[OrigID].m_Connection.AckSequence(), m_aSlots[OrigID].m_Connection.SecurityToken(), m_aSlots[OrigID].m_Connection.ResendBuffer());
m_aSlots[ClientID].m_Connection.SetTimedOut(ClientAddr(OrigID), m_aSlots[OrigID].m_Connection.SeqSequence(), m_aSlots[OrigID].m_Connection.AckSequence(), m_aSlots[OrigID].m_Connection.SecurityToken(), m_aSlots[OrigID].m_Connection.ResendBuffer(), m_aSlots[OrigID].m_Connection.m_Sixup);
m_aSlots[OrigID].m_Connection.Reset();
return true;
}

View file

@ -574,17 +574,28 @@ void CGameContext::ConTimeout(IConsole::IResult *pResult, void *pUserData)
const char* pTimeout = pResult->NumArguments() > 0 ? pResult->GetString(0) : pPlayer->m_TimeoutCode;
for(int i = 0; i < pSelf->Server()->MaxClients(); i++)
if(!pSelf->Server()->IsSixup(pResult->m_ClientID))
{
if (i == pResult->m_ClientID) continue;
if (!pSelf->m_apPlayers[i]) continue;
if (str_comp(pSelf->m_apPlayers[i]->m_TimeoutCode, pTimeout)) continue;
if (pSelf->Server()->SetTimedOut(i, pResult->m_ClientID)) {
if (pSelf->m_apPlayers[i]->GetCharacter())
pSelf->SendTuningParams(i, pSelf->m_apPlayers[i]->GetCharacter()->m_TuneZone);
return;
for(int i = 0; i < pSelf->Server()->MaxClients(); i++)
{
if (i == pResult->m_ClientID) continue;
if (!pSelf->m_apPlayers[i]) continue;
if (str_comp(pSelf->m_apPlayers[i]->m_TimeoutCode, pTimeout)) continue;
if (pSelf->Server()->SetTimedOut(i, pResult->m_ClientID))
{
if (pSelf->m_apPlayers[i]->GetCharacter())
pSelf->SendTuningParams(i, pSelf->m_apPlayers[i]->GetCharacter()->m_TuneZone);
/*if(pSelf->Server()->IsSixup(i))
pSelf->SendClientInfo(i, i);*/
return;
}
}
}
else
{
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "print",
"Your timeout code has been set. 0.7 clients can not reclaim their tees on timeout; however, a 0.6 client can claim your tee ");
}
pSelf->Server()->SetTimeoutProtected(pResult->m_ClientID);
str_copy(pPlayer->m_TimeoutCode, pResult->GetString(0), sizeof(pPlayer->m_TimeoutCode));