From ee2647de4191066453b11862895cb32d4b729427 Mon Sep 17 00:00:00 2001 From: eeeee Date: Sun, 23 Dec 2012 20:10:31 +0300 Subject: [PATCH] turns out that Drop was needed after all :S --- src/engine/server/server.cpp | 14 +++++++++++--- src/engine/shared/network_server.cpp | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index cbe744937..6176b5d80 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -750,11 +750,13 @@ int CServer::DelClientCallback(int ClientID, const char *pReason, void *pUser) static int lastsent[MAX_CLIENTS]; static int lastask[MAX_CLIENTS]; +static int lastasktick[MAX_CLIENTS]; void CServer::SendMap(int ClientID) { lastsent[ClientID] = 0; lastask[ClientID] = 0; + lastasktick[ClientID] = Tick(); CMsgPacker Msg(NETMSG_MAP_CHANGE); Msg.AddString(GetMapName(), 0); Msg.AddInt(m_CurrentMapCrc); @@ -882,6 +884,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) int Last = 0; lastask[ClientID] = Chunk; + lastasktick[ClientID] = Tick(); if (Chunk == 0) { lastsent[ClientID] = 0; @@ -899,7 +902,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) Last = 1; } - if (lastsent[ClientID]+ChunkSize < m_CurrentMapSize && lastsent[ClientID] < Chunk+g_Config.m_SvMapWindow && g_Config.m_SvFastDownload) + if (lastsent[ClientID] < Chunk+g_Config.m_SvMapWindow && g_Config.m_SvFastDownload) return; CMsgPacker Msg(NETMSG_MAP_DATA); @@ -908,7 +911,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) Msg.AddInt(Chunk); Msg.AddInt(ChunkSize); Msg.AddRaw(&m_pCurrentMapData[Offset], ChunkSize); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); + SendMsgEx(&Msg, MSGFLAG_FLUSH, ClientID, true); if(g_Config.m_Debug) { @@ -1227,6 +1230,11 @@ void CServer::PumpNetwork() { if (m_aClients[i].m_State != CClient::STATE_CONNECTING) continue; + if (lastasktick[i] < Tick()-TickSpeed()) + { + lastsent[i] = lastask[i]; + lastasktick[i] = Tick(); + } if (lastask[i]m_ClientID, "Error sending data"); + Drop(pChunk->m_ClientID, "Error sending data"); } } return 0;