summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-05-09 19:14:36 +0000
committerrubidium <rubidium@openttd.org>2012-05-09 19:14:36 +0000
commita961276b6f3167b47004e1b6b0a4efab96fddec2 (patch)
tree275a15e8a93da214099e1ab4721babf96dbc304a /src/network
parent640ff642ae5d4b128a38ad748955e2b34a952de4 (diff)
downloadopenttd-a961276b6f3167b47004e1b6b0a4efab96fddec2.tar.xz
(svn r24221) -Fix [FS#5166]: Lag counters were not properly reset when switching states making it possible to get disconnected for lagging when you weren't lagging
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_server.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 8cd1a5921..cd4e5f564 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -450,6 +450,8 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedGamePassword()
if (this->status >= STATUS_AUTH_GAME) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET);
this->status = STATUS_AUTH_GAME;
+ /* Reset 'lag' counters */
+ this->last_frame = this->last_frame_server = _frame_counter;
Packet *p = new Packet(PACKET_SERVER_NEED_GAME_PASSWORD);
this->SendPacket(p);
@@ -463,6 +465,8 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedCompanyPassword()
if (this->status >= STATUS_AUTH_COMPANY) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET);
this->status = STATUS_AUTH_COMPANY;
+ /* Reset 'lag' counters */
+ this->last_frame = this->last_frame_server = _frame_counter;
Packet *p = new Packet(PACKET_SERVER_NEED_COMPANY_PASSWORD);
p->Send_uint32(_settings_game.game_creation.generation_seed);
@@ -481,6 +485,9 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendWelcome()
if (this->status >= STATUS_AUTHORIZED) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET);
this->status = STATUS_AUTHORIZED;
+ /* Reset 'lag' counters */
+ this->last_frame = this->last_frame_server = _frame_counter;
+
_network_game_info.clients_on++;
p = new Packet(PACKET_SERVER_WELCOME);