SendToAll: also send while syncing

the missed packet queue handles this case
This commit is contained in:
Lion Kortlepel
2021-03-07 01:36:54 +01:00
committed by Anonymous275
parent 83145d7466
commit 05c5fb047c
2 changed files with 7 additions and 2 deletions

View File

@@ -104,6 +104,12 @@ void TTCPServer::Authentication(SOCKET TCPSock) {
return;
}
if (!AuthResponse.IsObject()) {
ClientKick(*Client, "Backend returned invalid auth response format.");
error("Backend returned invalid auth response format. This should never happen.");
return;
}
if (AuthResponse["username"].IsString() && AuthResponse["roles"].IsString()
&& AuthResponse["guest"].IsBool() && AuthResponse["identifiers"].IsArray()) {
@@ -166,7 +172,6 @@ bool TTCPServer::TCPSend(TClient& c, const std::string& Data, bool IsSync) {
c.EnqueueMissedPacketDuringSyncing(Data);
return true;
} else if (!c.IsSyncing() && c.IsSynced() && c.MissedPacketQueueSize() != 0) {
std::this_thread::sleep_for(std::chrono::seconds(1));
while (c.MissedPacketQueueSize() > 0) {
std::string QData = c.MissedPacketQueue().front();
c.MissedPacketQueue().pop();

View File

@@ -97,7 +97,7 @@ void TUDPServer::SendToAll(TClient* c, const std::string& Data, bool Self, bool
if (!ClientPtr.expired()) {
auto Client = ClientPtr.lock();
if (Self || Client.get() != c) {
if (Client->IsSynced()) {
if (Client->IsSynced() || Client->IsSyncing()) {
if (Rel || C == 'W' || C == 'Y' || C == 'V' || C == 'E') {
if (C == 'O' || C == 'T' || Data.length() > 1000)
mTCPServer.SendLarge(*Client, Data);