mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
CR feedback
This commit is contained in:
parent
a655557af0
commit
df24fafe49
2 changed files with 16 additions and 7 deletions
|
@ -868,6 +868,16 @@ void OctreeServer::parsePayload() {
|
|||
}
|
||||
}
|
||||
|
||||
OctreeServer::UniqueSendThread OctreeServer::createSendThread(const SharedNodePointer& node) {
|
||||
auto sendThread = std::unique_ptr<OctreeSendThread>(new OctreeSendThread(this, node));
|
||||
|
||||
// we want to be notified when the thread finishes
|
||||
connect(sendThread.get(), &GenericThread::finished, this, &OctreeServer::removeSendThread);
|
||||
sendThread->initialize(true);
|
||||
|
||||
return sendThread;
|
||||
}
|
||||
|
||||
void OctreeServer::removeSendThread() {
|
||||
auto sendThread = static_cast<OctreeSendThread*>(sender());
|
||||
|
||||
|
@ -884,12 +894,7 @@ void OctreeServer::handleOctreeQueryPacket(QSharedPointer<ReceivedMessage> messa
|
|||
|
||||
auto it = _sendThreads.find(senderNode->getUUID());
|
||||
if (it == _sendThreads.end() || it->second->isShuttingDown()) {
|
||||
auto sendThread = std::unique_ptr<OctreeSendThread>(new OctreeSendThread(this, senderNode));
|
||||
|
||||
// we want to be notified when the thread finishes
|
||||
connect(sendThread.get(), &GenericThread::finished, this, &OctreeServer::removeSendThread);
|
||||
sendThread->initialize(true);
|
||||
_sendThreads.emplace(senderNode->getUUID(), std::move(sendThread));
|
||||
_sendThreads.emplace(senderNode->getUUID(), createSendThread(senderNode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,6 +140,9 @@ private slots:
|
|||
void removeSendThread();
|
||||
|
||||
protected:
|
||||
using UniqueSendThread = std::unique_ptr<OctreeSendThread>;
|
||||
using SendThreads = std::unordered_map<QUuid, UniqueSendThread>;
|
||||
|
||||
virtual OctreePointer createTree() = 0;
|
||||
bool readOptionBool(const QString& optionName, const QJsonObject& settingsSectionObject, bool& result);
|
||||
bool readOptionInt(const QString& optionName, const QJsonObject& settingsSectionObject, int& result);
|
||||
|
@ -153,6 +156,8 @@ protected:
|
|||
QString getFileLoadTime();
|
||||
QString getConfiguration();
|
||||
QString getStatusLink();
|
||||
|
||||
UniqueSendThread createSendThread(const SharedNodePointer& node);
|
||||
|
||||
int _argc;
|
||||
const char** _argv;
|
||||
|
@ -191,7 +196,6 @@ protected:
|
|||
quint64 _startedUSecs;
|
||||
QString _safeServerName;
|
||||
|
||||
using SendThreads = std::unordered_map<QUuid, std::unique_ptr<OctreeSendThread>>;
|
||||
SendThreads _sendThreads;
|
||||
|
||||
static int _clientCount;
|
||||
|
|
Loading…
Reference in a new issue