This commit is contained in:
Atlante45 2017-02-03 11:26:29 -08:00
parent 72ed1add94
commit 3a30de79aa
6 changed files with 9 additions and 20 deletions

View file

@ -3,7 +3,7 @@
// assignment-client/src
//
// Created by Clement on 12/14/15.
// Copyright 2017 High Fidelity, Inc.
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html

View file

@ -3,7 +3,7 @@
// assignment-client/src
//
// Created by Clement on 12/14/15.
// Copyright 2017 High Fidelity, Inc.
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html

View file

@ -80,9 +80,8 @@ EntityScriptServer::EntityScriptServer(ReceivedMessage& message) : ThreadedAssig
packetReceiver.registerListener(PacketType::EntityScriptGetStatus, this, "handleEntityScriptGetStatusPacket");
packetReceiver.registerListener(PacketType::EntityServerScriptLog, this, "handleEntityServerScriptLogPacket");
static const int LOG_INTERVAL = MSECS_PER_SECOND / 50;
static const int LOG_INTERVAL = MSECS_PER_SECOND / 10;
auto timer = new QTimer(this);
timer->setTimerType(Qt::PreciseTimer);
timer->setInterval(LOG_INTERVAL);
connect(timer, &QTimer::timeout, this, &EntityScriptServer::pushLogs);
timer->start();
@ -215,24 +214,15 @@ void EntityScriptServer::pushLogs() {
return;
}
auto packet = NLPacket::create(PacketType::EntityServerScriptLog, buffer.size(), true);
packet->write(buffer.data(), buffer.size());
auto nodeList = DependencyManager::get<NodeList>();
auto last = --std::end(_logListeners);
for (auto it = std::begin(_logListeners); it != last; ++it) {
auto node = nodeList->nodeWithUUID(*it);
for (auto uuid : _logListeners) {
auto node = nodeList->nodeWithUUID(uuid);
if (node && node->getActiveSocket()) {
auto copy = NLPacket::createCopy(*packet);
nodeList->sendPacket(std::move(copy), *node);
auto packet = NLPacketList::create(PacketType::EntityServerScriptLog, QByteArray(), true, true);
packet->write(buffer.data(), buffer.size());
nodeList->sendPacketList(std::move(packet), *node);
}
}
auto node = nodeList->nodeWithUUID(*last);
if (node && node->getActiveSocket()) {
nodeList->sendPacket(std::move(packet), *node);
}
}
void EntityScriptServer::run() {

View file

@ -63,6 +63,7 @@
#include <DebugDraw.h>
#include <DeferredLightingEffect.h>
#include <EntityScriptClient.h>
#include <EntityScriptServerLogClient.h>
#include <EntityScriptingInterface.h>
#include <ErrorDialog.h>
#include <FileScriptingInterface.h>
@ -134,7 +135,6 @@
#include "devices/Faceshift.h"
#include "devices/Leapmotion.h"
#include "DiscoverabilityManager.h"
#include "EntityScriptServerLogClient.h"
#include "GLCanvas.h"
#include "InterfaceActionFactory.h"
#include "InterfaceLogging.h"
@ -176,7 +176,6 @@
#include "FrameTimingsScriptingInterface.h"
#include <GPUIdent.h>
#include <gl/GLHelpers.h>
#include <EntityScriptClient.h>
// On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
// FIXME seems to be broken.