From 54ec3b776a2acccb2242ab39ae2186e49808a05e Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Thu, 4 Nov 2021 09:45:40 +0100 Subject: [PATCH] fix: connection rate limit --- src/game/Connexion.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/Connexion.cpp b/src/game/Connexion.cpp index 5a1c0d2..3fc055e 100644 --- a/src/game/Connexion.cpp +++ b/src/game/Connexion.cpp @@ -32,9 +32,11 @@ bool Connexion::updateSocket() { if (m_Socket.GetStatus() != network::Socket::Connected) return false; - DataBuffer buffer; - m_Socket.Receive(buffer, sizeof(std::uint64_t)); - if (buffer.GetSize() > 0) { + while (true) { + DataBuffer buffer; + m_Socket.Receive(buffer, sizeof(std::uint64_t)); + if (buffer.GetSize() == 0) + break; std::uint64_t packetLenght; buffer >> packetLenght;