diff --git a/src/engine/shared/network.h b/src/engine/shared/network.h index dd43389ec..80bd53c0a 100644 --- a/src/engine/shared/network.h +++ b/src/engine/shared/network.h @@ -187,6 +187,7 @@ public: // Needed for GotProblems in NetClient int64 LastRecvTime() const { return m_LastRecvTime; } + int64 ConnectTime() const { return m_LastUpdateTime; } int AckSequence() const { return m_Ack; } }; diff --git a/src/engine/shared/network_conn.cpp b/src/engine/shared/network_conn.cpp index ed0d40cdf..ea60fca8c 100644 --- a/src/engine/shared/network_conn.cpp +++ b/src/engine/shared/network_conn.cpp @@ -124,8 +124,7 @@ int CNetConnection::QueueChunkEx(int Flags, int DataSize, const void *pData, int } else { - // out of buffer - Disconnect("too weak connection (out of buffer)"); + // out of buffer, don't save the packet and hope nobody will ask for resend return -1; } } diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index 1264a4a5a..f0aa6196b 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -69,11 +69,17 @@ int CNetServer::Drop(int ClientID, const char *pReason) int CNetServer::Update() { + int64 Now = time_get(); for(int i = 0; i < MaxClients(); i++) { m_aSlots[i].m_Connection.Update(); if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_ERROR) - Drop(i, m_aSlots[i].m_Connection.ErrorString()); + { + if (Now - m_aSlots[i].m_Connection.ConnectTime() < time_freq() && NetBan()) + NetBan()->BanAddr(ClientAddr(i), 60, "Stressing network"); + else + Drop(i, m_aSlots[i].m_Connection.ErrorString()); + } } return 0;