consider assignment completed when worker thread is gone

This commit is contained in:
Stephen Birarda 2015-05-08 10:40:04 -07:00
parent b080dfc1cf
commit be58347aec
2 changed files with 7 additions and 7 deletions

View file

@ -231,15 +231,15 @@ void AssignmentClient::readPendingDatagrams() {
connect(_currentAssignment.data(), &ThreadedAssignment::finished, _currentAssignment.data(),
&ThreadedAssignment::deleteLater);
// once it is deleted, we take down the worker thread
// once it is deleted, we quit the worker thread
connect(_currentAssignment.data(), &ThreadedAssignment::destroyed, workerThread, &QThread::quit);
// once the worker thread says it is done, we consider the assignment completed
connect(workerThread, &QThread::finished, this, &AssignmentClient::assignmentCompleted);
// have the worker thread remove itself once it is done
connect(workerThread, &QThread::finished, workerThread, &QThread::deleteLater);
// once the worker thread says it is done, we consider the assignment completed
connect(workerThread, &QThread::destroyed, this, &AssignmentClient::assignmentCompleted);
_currentAssignment->moveToThread(workerThread);
// move the NodeList to the thread used for the _current assignment
@ -311,7 +311,6 @@ void AssignmentClient::assignmentCompleted() {
auto nodeList = DependencyManager::get<NodeList>();
// have us handle incoming NodeList datagrams again, and make sure our ThreadedAssignment isn't handling them
disconnect(&nodeList->getNodeSocket(), 0, _currentAssignment, 0);
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClient::readPendingDatagrams);
// reset our NodeList by switching back to unassigned and clearing the list

View file

@ -150,8 +150,9 @@ void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer&
void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteArray& packet) {
switch (packetTypeForPacket(packet)) {
case PacketTypeDomainList: {
if (_domainHandler.isConnected()) {
// only process a list from domain-server if we think we're connected
if (!_domainHandler.getSockAddr().isNull()) {
// only process a list from domain-server if we're talking to a domain
// TODO: how do we make sure this is actually the domain we want the list from (DTLS probably)
processDomainServerList(packet);
}
break;