diff --git a/src/engine/shared/network.h b/src/engine/shared/network.h index 920f2297a..1fd75b113 100644 --- a/src/engine/shared/network.h +++ b/src/engine/shared/network.h @@ -220,7 +220,9 @@ public: int AckSequence() const { return m_Ack; } int SeqSequence() const { return m_Sequence; } int SecurityToken() const { return m_SecurityToken; } - void SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken); + TStaticRingBuffer *ResendBuffer() { return &m_Buffer; }; + + void SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer *pResendBuffer); // anti spoof void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken); diff --git a/src/engine/shared/network_conn.cpp b/src/engine/shared/network_conn.cpp index e68ef5abe..333997378 100644 --- a/src/engine/shared/network_conn.cpp +++ b/src/engine/shared/network_conn.cpp @@ -467,7 +467,7 @@ int CNetConnection::Update() return 0; } -void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken) +void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer *pResendBuffer) { int64 Now = time_get(); @@ -482,5 +482,16 @@ void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SE m_LastRecvTime = Now; m_LastUpdateTime = Now; m_SecurityToken = SecurityToken; + + // copy resend buffer m_Buffer.Init(); + while (pResendBuffer->First()) + { + CNetChunkResend *First = pResendBuffer->First(); + + CNetChunkResend *pResend = m_Buffer.Allocate(sizeof(CNetChunkResend)+First->m_DataSize); + mem_copy(pResend, First, sizeof(CNetChunkResend)+First->m_DataSize); + + pResendBuffer->PopFirst(); + } } diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index 7f994d605..93c761281 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -684,7 +684,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[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.Reset(); return true; }