From 28905c46592dd79e20a64e46d3adb1bf9b034863 Mon Sep 17 00:00:00 2001 From: Learath Date: Sat, 20 Jun 2020 19:50:14 +0300 Subject: [PATCH] Disable timeout for 0.7 clients --- src/engine/server/server.cpp | 2 ++ src/engine/shared/network.h | 2 +- src/engine/shared/network_conn.cpp | 3 ++- src/engine/shared/network_server.cpp | 2 +- src/game/server/ddracechat.cpp | 27 +++++++++++++++++++-------- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index b5a173642..5942eee9c 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -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; diff --git a/src/engine/shared/network.h b/src/engine/shared/network.h index 18d20faa3..0f578199c 100644 --- a/src/engine/shared/network.h +++ b/src/engine/shared/network.h @@ -234,7 +234,7 @@ public: int SecurityToken() const { return m_SecurityToken; } TStaticRingBuffer *ResendBuffer() { return &m_Buffer; }; - void SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer *pResendBuffer); + void SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer *pResendBuffer, bool Sixup); // anti spoof void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup); diff --git a/src/engine/shared/network_conn.cpp b/src/engine/shared/network_conn.cpp index f4868ad39..be553090a 100644 --- a/src/engine/shared/network_conn.cpp +++ b/src/engine/shared/network_conn.cpp @@ -472,7 +472,7 @@ int CNetConnection::Update() return 0; } -void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer *pResendBuffer) +void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer *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(); diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index fd5752de5..63e356614 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -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; } diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index b662735c3..4a7380d77 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -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));