From 55ba39ca0e2d4aed9c0c1b3e030727728ea0a02f Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 17 Mar 2021 23:18:02 +0000 Subject: Don't send ping updates one packet at a time * Use the batch update feature of the packet. * Lengthen interval between time and ping update packets (ref. http://github.com/cuberite/cuberite/issues/4082#issuecomment-348675321). --- src/Entities/Player.cpp | 12 ------------ src/Entities/Player.h | 2 -- 2 files changed, 14 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index b6997f5f1..e431e4cc5 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -34,9 +34,6 @@ // 6000 ticks or 5 minutes #define PLAYER_INVENTORY_SAVE_INTERVAL 6000 -// 1000 = once per second -#define PLAYER_LIST_TIME_MS std::chrono::milliseconds(1000) - namespace { @@ -131,8 +128,6 @@ cPlayer::cPlayer(const cClientHandlePtr & a_Client) : SetMaxHealth(MAX_HEALTH); m_Health = MAX_HEALTH; - m_LastPlayerListTime = std::chrono::steady_clock::now(); - cWorld * World = nullptr; if (!LoadFromDisk(World)) { @@ -3205,13 +3200,6 @@ void cPlayer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) // Update items (e.g. Maps) m_Inventory.UpdateItems(); - // Send Player List (Once per m_LastPlayerListTime/1000 ms) - if (m_LastPlayerListTime + PLAYER_LIST_TIME_MS <= std::chrono::steady_clock::now()) - { - m_World->BroadcastPlayerListUpdatePing(*this); - m_LastPlayerListTime = std::chrono::steady_clock::now(); - } - if (m_TicksUntilNextSave == 0) { SaveToDisk(); diff --git a/src/Entities/Player.h b/src/Entities/Player.h index f7d54340e..86d4a2a07 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -656,8 +656,6 @@ private: /** The item being dragged by the cursor while in a UI window */ cItem m_DraggingItem; - std::chrono::steady_clock::time_point m_LastPlayerListTime; - cClientHandlePtr m_ClientHandle; cSlotNums m_InventoryPaintSlots; -- cgit v1.2.3