History

fix for audio-mixer shutdown hang, removing spaces

Stephen Birarda committed 11 years ago

Commit ca87d641 parent 12a8f146 files · +229 −224Browse files

Showing the changes to libraries/networking/src/ThreadedAssignment.cpp (1 of 6 files). Show all

Unified · Split

libraries/networking/src/ThreadedAssignment.cpp+16−15
@@ -23,7 +23,7 @@ ThreadedAssignment::ThreadedAssignment(const QByteArray& packet) : · 22 unmodified lines
2323 _isFinished(false),
2424 _datagramProcessingThread(NULL)
2525 {
26−
26+
2727 }
2828
2929 void ThreadedAssignment::setFinished(bool isFinished) {
@@ -41,7 +41,7 @@ void ThreadedAssignment::setFinished(bool isFinished) { · 11 unmodified lines
4141 if (_statsTimer) {
4242 _statsTimer->stop();
4343 }
44−
44+
4545 // stop processing datagrams from the node socket
4646 // this ensures we won't process a domain list while we are going down
4747 auto nodeList = DependencyManager::get<NodeList>();
@@ -52,20 +52,21 @@ void ThreadedAssignment::setFinished(bool isFinished) { · 4 unmodified lines
5252
5353 // if we have a datagram processing thread, quit it and wait on it to make sure that
5454 // the node socket is back on the same thread as the NodeList
55−
55+
56+
5657 if (_datagramProcessingThread) {
57− // tell the datagram processing thread to quit and wait until it is done,
58+ // tell the datagram processing thread to quit and wait until it is done,
5859 // then return the node socket to the NodeList
5960 _datagramProcessingThread->quit();
6061 _datagramProcessingThread->wait();
61−
62+
6263 // set node socket parent back to NodeList
6364 nodeList->getNodeSocket().setParent(nodeList.data());
6465 }
65−
66+
6667 // move the NodeList back to the QCoreApplication instance's thread
6768 nodeList->moveToThread(QCoreApplication::instance()->thread());
68−
69+
6970 emit finished();
7071 }
7172 }
@@ -74,17 +75,17 @@ void ThreadedAssignment::setFinished(bool isFinished) { · 2 unmodified lines
7475 void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeType, bool shouldSendStats) {
7576 // change the logging target name while the assignment is running
7677 LogHandler::getInstance().setTargetName(targetName);
77−
78+
7879 auto nodeList = DependencyManager::get<NodeList>();
7980 nodeList->setOwnerType(nodeType);
80−
81+
8182 // this is a temp fix for Qt 5.3 - rebinding the node socket gives us readyRead for the socket on this thread
8283 nodeList->rebindNodeSocket();
83−
84+
8485 _domainServerTimer = new QTimer();
8586 connect(_domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit()));
8687 _domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
87−
88+
8889 if (shouldSendStats) {
8990 // send a stats packet every 1 second
9091 _statsTimer = new QTimer();
@@ -95,15 +96,15 @@ void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeTy · 4 unmodified lines
9596
9697 void ThreadedAssignment::addPacketStatsAndSendStatsPacket(QJsonObject &statsObject) {
9798 auto nodeList = DependencyManager::get<NodeList>();
98−
99+
99100 float packetsPerSecond, bytesPerSecond;
100101 // XXX can BandwidthRecorder be used for this?
101102 nodeList->getPacketStats(packetsPerSecond, bytesPerSecond);
102103 nodeList->resetPacketStats();
103−
104+
104105 statsObject["packets_per_second"] = packetsPerSecond;
105106 statsObject["bytes_per_second"] = bytesPerSecond;
106−
107+
107108 nodeList->sendStatsToDomainServer(statsObject);
108109 }
109110
@@ -122,7 +123,7 @@ void ThreadedAssignment::checkInWithDomainServerOrExit() { · 12 unmodified lines
122123
123124 bool ThreadedAssignment::readAvailableDatagram(QByteArray& destinationByteArray, HifiSockAddr& senderSockAddr) {
124125 auto nodeList = DependencyManager::get<NodeList>();
125−
126+
126127 if (nodeList->getNodeSocket().hasPendingDatagrams()) {
127128 destinationByteArray.resize(nodeList->getNodeSocket().pendingDatagramSize());
128129 nodeList->getNodeSocket().readDatagram(destinationByteArray.data(), destinationByteArray.size(),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t