Initiate thread sleeping after each initial message to not spam clients

This commit is contained in:
Alexander Bock
2015-05-12 22:41:53 +02:00
parent 072b9d7bef
commit b5846cc69b

View File

@@ -28,6 +28,8 @@
#include <openspace/engine/openspaceengine.h>
#include <array>
#include <chrono>
#include <thread>
#include "sgct.h"
@@ -181,6 +183,7 @@ void NetworkEngine::sendMessages() {
}
void NetworkEngine::sendInitialInformation() {
static const int SleepTime = 25;
for (const Message& m : _initialConnectionMessages) {
union {
MessageIdentifier value;
@@ -194,7 +197,9 @@ void NetworkEngine::sendInitialInformation() {
payload.data(),
static_cast<int>(payload.size())
);
std::this_thread::sleep_for(std::chrono::milliseconds(SleepTime));
}
}
void NetworkEngine::setInitialConnectionMessage(MessageIdentifier identifier, std::vector<char> message) {