removed connect(); put call into Application::nodeKilled

OctreePacketReceiver::nodeKilled() doesn't get called when
NodeList::nodeKilled() is emitted for some unknown reason
This commit is contained in:
wangyix 2014-06-11 15:25:00 -07:00
parent a8c9780004
commit ac0b037f0f
3 changed files with 11 additions and 2 deletions

View file

@ -244,7 +244,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer)));
connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), &_voxels, SLOT(nodeAdded(SharedNodePointer)));
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), &_voxels, SLOT(nodeKilled(SharedNodePointer)));
connect(NodeList::getInstance(), &NodeList::nodeKilled, &_octreeProcessor, &ReceivedPacketProcessor::nodeKilled);
connect(nodeList, &NodeList::uuidChanged, this, &Application::updateWindowTitle);
connect(nodeList, SIGNAL(uuidChanged(const QUuid&)), _myAvatar, SLOT(setSessionUUID(const QUuid&)));
connect(nodeList, &NodeList::limitOfSilentDomainCheckInsReached, nodeList, &NodeList::reset);
@ -3249,6 +3248,11 @@ void Application::nodeAdded(SharedNodePointer node) {
}
void Application::nodeKilled(SharedNodePointer node) {
// this is here because connecting NodeList::nodeKilled to OctreePacketProcessor::nodeKilled doesn't work:
// OctreePacketProcessor::nodeKilled is not called when NodeList::nodeKilled is emitted for some reason.
_octreeProcessor.nodeKilled(node);
if (node->getType() == NodeType::VoxelServer) {
QUuid nodeUUID = node->getUUID();
// see if this is the first we've heard of this node...

View file

@ -367,6 +367,7 @@ void LimitedNodeList::killNodeWithUUID(const QUuid& nodeUUID) {
NodeHash::iterator LimitedNodeList::killNodeAtHashIterator(NodeHash::iterator& nodeItemToKill) {
qDebug() << "Killed" << *nodeItemToKill.value();
emit nodeKilled(nodeItemToKill.value());
printf("\t\t\t emitting nodeKilled: %s\n", nodeItemToKill.value()->getUUID().toString().toLatin1().data());
return _nodeHash.erase(nodeItemToKill);
}

View file

@ -51,5 +51,9 @@ bool ReceivedPacketProcessor::process() {
}
void ReceivedPacketProcessor::nodeKilled(SharedNodePointer node) {
_nodePacketCounts.remove(node->getUUID());
lock();
int numRemoved = _nodePacketCounts.remove(node->getUUID());
unlock();
qDebug() << "RPP::killNode *************************************";
printf("\t\t RPP::killNode: %s killed %d nodes\n", node->getUUID().toString().toLatin1().data(), numRemoved);
}