mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +02:00
ensure no new OST creation on OctreeServer shutdown
This commit is contained in:
parent
bab96a7711
commit
0f71e93c7f
3 changed files with 20 additions and 5 deletions
|
@ -1216,6 +1216,11 @@ void OctreeServer::aboutToFinish() {
|
|||
qDebug() << qPrintable(_safeServerName) << "server STARTING about to finish...";
|
||||
qDebug() << qPrintable(_safeServerName) << "inform Octree Inbound Packet Processor that we are shutting down...";
|
||||
|
||||
// we're going down - set the NodeList linkedDataCallback to NULL so we do not create any more OctreeSendThreads
|
||||
// this ensures that when we forceNodeShutdown below for each node we don't get any more newly connecting nodes
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->linkedDataCreateCallback = NULL;
|
||||
|
||||
if (_octreeInboundPacketProcessor) {
|
||||
_octreeInboundPacketProcessor->terminating();
|
||||
}
|
||||
|
@ -1224,7 +1229,9 @@ void OctreeServer::aboutToFinish() {
|
|||
_jurisdictionSender->terminating();
|
||||
}
|
||||
|
||||
DependencyManager::get<NodeList>()->eachNode([this](const SharedNodePointer& node) {
|
||||
// force a shutdown of all of our OctreeSendThreads - at this point it has to be impossible for a
|
||||
// linkedDataCreateCallback to be called for a new node
|
||||
nodeList->eachNode([this](const SharedNodePointer& node) {
|
||||
qDebug() << qPrintable(_safeServerName) << "server about to finish while node still connected node:" << *node;
|
||||
forceNodeShutdown(node);
|
||||
});
|
||||
|
|
|
@ -150,7 +150,10 @@ void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer&
|
|||
void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteArray& packet) {
|
||||
switch (packetTypeForPacket(packet)) {
|
||||
case PacketTypeDomainList: {
|
||||
processDomainServerList(packet);
|
||||
if (_domainHandler.isConnected()) {
|
||||
// only process a list from domain-server if we think we're connected
|
||||
processDomainServerList(packet);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PacketTypeDomainServerRequireDTLS: {
|
||||
|
|
|
@ -41,16 +41,21 @@ void ThreadedAssignment::setFinished(bool isFinished) {
|
|||
if (_statsTimer) {
|
||||
_statsTimer->stop();
|
||||
}
|
||||
|
||||
aboutToFinish();
|
||||
|
||||
// stop processing datagrams from the node socket
|
||||
// this ensures we won't process a domain list while we are going down
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
disconnect(&nodeList->getNodeSocket(), 0, this, 0);
|
||||
|
||||
// call our virtual aboutToFinish method - this gives the ThreadedAssignment subclass a chance to cleanup
|
||||
aboutToFinish();
|
||||
|
||||
// if we have a datagram processing thread, quit it and wait on it to make sure that
|
||||
// the node socket is back on the same thread as the NodeList
|
||||
|
||||
if (_datagramProcessingThread) {
|
||||
// tell the datagram processing thread to quit and wait until it is done, then return the node socket to the NodeList
|
||||
// tell the datagram processing thread to quit and wait until it is done,
|
||||
// then return the node socket to the NodeList
|
||||
_datagramProcessingThread->quit();
|
||||
_datagramProcessingThread->wait();
|
||||
|
||||
|
|
Loading…
Reference in a new issue