summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/tcp_game.cpp3
-rw-r--r--src/network/core/tcp_game.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp
index 4f4baeb6b..3cf1a468b 100644
--- a/src/network/core/tcp_game.cpp
+++ b/src/network/core/tcp_game.cpp
@@ -30,6 +30,7 @@ NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s)
this->sock = s;
this->last_frame = _frame_counter;
this->last_frame_server = _frame_counter;
+ this->last_packet = _realtime_tick;
}
/**
@@ -70,6 +71,8 @@ NetworkRecvStatus NetworkGameSocketHandler::HandlePacket(Packet *p)
{
PacketGameType type = (PacketGameType)p->Recv_uint8();
+ this->last_packet = _realtime_tick;
+
switch (this->HasClientQuit() ? PACKET_END : type) {
GAME_COMMAND(PACKET_SERVER_FULL)
GAME_COMMAND(PACKET_SERVER_BANNED)
diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h
index a2e0226be..b4a6999cd 100644
--- a/src/network/core/tcp_game.h
+++ b/src/network/core/tcp_game.h
@@ -473,6 +473,7 @@ public:
uint32 last_frame; ///< Last frame we have executed
uint32 last_frame_server; ///< Last frame the server has executed
CommandQueue incoming_queue; ///< The command-queue awaiting handling
+ uint last_packet; ///< Time we received the last frame.
NetworkRecvStatus CloseConnection(bool error = true);
virtual NetworkRecvStatus CloseConnection(NetworkRecvStatus status) = 0;