mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Disable timeout for 0.7 clients
This commit is contained in:
parent
17e77d73bb
commit
28905c4659
|
@ -3589,6 +3589,8 @@ bool CServer::SetTimedOut(int ClientID, int OrigID)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
m_aClients[ClientID].m_Sixup = m_aClients[OrigID].m_Sixup;
|
||||||
|
|
||||||
DelClientCallback(OrigID, "Timeout Protection used", this);
|
DelClientCallback(OrigID, "Timeout Protection used", this);
|
||||||
m_aClients[ClientID].m_Authed = AUTHED_NO;
|
m_aClients[ClientID].m_Authed = AUTHED_NO;
|
||||||
m_aClients[ClientID].m_Flags = m_aClients[OrigID].m_Flags;
|
m_aClients[ClientID].m_Flags = m_aClients[OrigID].m_Flags;
|
||||||
|
|
|
@ -234,7 +234,7 @@ public:
|
||||||
int SecurityToken() const { return m_SecurityToken; }
|
int SecurityToken() const { return m_SecurityToken; }
|
||||||
TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *ResendBuffer() { return &m_Buffer; };
|
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
|
// anti spoof
|
||||||
void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup);
|
void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup);
|
||||||
|
|
|
@ -472,7 +472,7 @@ int CNetConnection::Update()
|
||||||
return 0;
|
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();
|
int64 Now = time_get();
|
||||||
|
|
||||||
|
@ -487,6 +487,7 @@ void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SE
|
||||||
m_LastRecvTime = Now;
|
m_LastRecvTime = Now;
|
||||||
m_LastUpdateTime = Now;
|
m_LastUpdateTime = Now;
|
||||||
m_SecurityToken = SecurityToken;
|
m_SecurityToken = SecurityToken;
|
||||||
|
m_Sixup = Sixup;
|
||||||
|
|
||||||
// copy resend buffer
|
// copy resend buffer
|
||||||
m_Buffer.Init();
|
m_Buffer.Init();
|
||||||
|
|
|
@ -813,7 +813,7 @@ bool CNetServer::SetTimedOut(int ClientID, int OrigID)
|
||||||
if (m_aSlots[ClientID].m_Connection.State() != NET_CONNSTATE_ERROR)
|
if (m_aSlots[ClientID].m_Connection.State() != NET_CONNSTATE_ERROR)
|
||||||
return false;
|
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();
|
m_aSlots[OrigID].m_Connection.Reset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -574,17 +574,28 @@ void CGameContext::ConTimeout(IConsole::IResult *pResult, void *pUserData)
|
||||||
|
|
||||||
const char* pTimeout = pResult->NumArguments() > 0 ? pResult->GetString(0) : pPlayer->m_TimeoutCode;
|
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;
|
for(int i = 0; i < pSelf->Server()->MaxClients(); i++)
|
||||||
if (!pSelf->m_apPlayers[i]) continue;
|
{
|
||||||
if (str_comp(pSelf->m_apPlayers[i]->m_TimeoutCode, pTimeout)) continue;
|
if (i == pResult->m_ClientID) continue;
|
||||||
if (pSelf->Server()->SetTimedOut(i, pResult->m_ClientID)) {
|
if (!pSelf->m_apPlayers[i]) continue;
|
||||||
if (pSelf->m_apPlayers[i]->GetCharacter())
|
if (str_comp(pSelf->m_apPlayers[i]->m_TimeoutCode, pTimeout)) continue;
|
||||||
pSelf->SendTuningParams(i, pSelf->m_apPlayers[i]->GetCharacter()->m_TuneZone);
|
if (pSelf->Server()->SetTimedOut(i, pResult->m_ClientID))
|
||||||
return;
|
{
|
||||||
|
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);
|
pSelf->Server()->SetTimeoutProtected(pResult->m_ClientID);
|
||||||
str_copy(pPlayer->m_TimeoutCode, pResult->GetString(0), sizeof(pPlayer->m_TimeoutCode));
|
str_copy(pPlayer->m_TimeoutCode, pResult->GetString(0), sizeof(pPlayer->m_TimeoutCode));
|
||||||
|
|
Loading…
Reference in a new issue