mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +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() {
|
void OctreeServer::removeSendThread() {
|
||||||
auto sendThread = static_cast<OctreeSendThread*>(sender());
|
auto sendThread = static_cast<OctreeSendThread*>(sender());
|
||||||
|
|
||||||
|
@ -884,12 +894,7 @@ void OctreeServer::handleOctreeQueryPacket(QSharedPointer<ReceivedMessage> messa
|
||||||
|
|
||||||
auto it = _sendThreads.find(senderNode->getUUID());
|
auto it = _sendThreads.find(senderNode->getUUID());
|
||||||
if (it == _sendThreads.end() || it->second->isShuttingDown()) {
|
if (it == _sendThreads.end() || it->second->isShuttingDown()) {
|
||||||
auto sendThread = std::unique_ptr<OctreeSendThread>(new OctreeSendThread(this, senderNode));
|
_sendThreads.emplace(senderNode->getUUID(), createSendThread(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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,9 @@ private slots:
|
||||||
void removeSendThread();
|
void removeSendThread();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
using UniqueSendThread = std::unique_ptr<OctreeSendThread>;
|
||||||
|
using SendThreads = std::unordered_map<QUuid, UniqueSendThread>;
|
||||||
|
|
||||||
virtual OctreePointer createTree() = 0;
|
virtual OctreePointer createTree() = 0;
|
||||||
bool readOptionBool(const QString& optionName, const QJsonObject& settingsSectionObject, bool& result);
|
bool readOptionBool(const QString& optionName, const QJsonObject& settingsSectionObject, bool& result);
|
||||||
bool readOptionInt(const QString& optionName, const QJsonObject& settingsSectionObject, int& result);
|
bool readOptionInt(const QString& optionName, const QJsonObject& settingsSectionObject, int& result);
|
||||||
|
@ -154,6 +157,8 @@ protected:
|
||||||
QString getConfiguration();
|
QString getConfiguration();
|
||||||
QString getStatusLink();
|
QString getStatusLink();
|
||||||
|
|
||||||
|
UniqueSendThread createSendThread(const SharedNodePointer& node);
|
||||||
|
|
||||||
int _argc;
|
int _argc;
|
||||||
const char** _argv;
|
const char** _argv;
|
||||||
char** _parsedArgV;
|
char** _parsedArgV;
|
||||||
|
@ -191,7 +196,6 @@ protected:
|
||||||
quint64 _startedUSecs;
|
quint64 _startedUSecs;
|
||||||
QString _safeServerName;
|
QString _safeServerName;
|
||||||
|
|
||||||
using SendThreads = std::unordered_map<QUuid, std::unique_ptr<OctreeSendThread>>;
|
|
||||||
SendThreads _sendThreads;
|
SendThreads _sendThreads;
|
||||||
|
|
||||||
static int _clientCount;
|
static int _clientCount;
|
||||||
|
|
Loading…
Reference in a new issue