History

repair assignment flow errors from packet changes

Stephen Birarda committed 12 years ago

Commit 85ebad91 parent 3854f755 files · +54 −38Browse files

Showing the changes to assignment-client/src/AssignmentClient.cpp (1 of 5 files). Show all

Unified · Split

assignment-client/src/AssignmentClient.cpp+30−26
@@ -124,32 +124,36 @@ void AssignmentClient::readPendingDatagrams() { · 123 unmodified lines
124 // construct the deployed assignment from the packet data124 // construct the deployed assignment from the packet data
125 _currentAssignment = AssignmentFactory::unpackAssignment(receivedPacket);125 _currentAssignment = AssignmentFactory::unpackAssignment(receivedPacket);
126 126
127 qDebug() << "Received an assignment -" << *_currentAssignment;127 if (_currentAssignment) {
128 128 qDebug() << "Received an assignment -" << *_currentAssignment;
129 // switch our nodelist domain IP and port to whoever sent us the assignment129
130 130 // switch our nodelist domain IP and port to whoever sent us the assignment
131 nodeList->setDomainSockAddr(senderSockAddr);131
132 nodeList->setOwnerUUID(_currentAssignment->getUUID());132 nodeList->setDomainSockAddr(senderSockAddr);
133 133 nodeList->setOwnerUUID(_currentAssignment->getUUID());
134 qDebug() << "Destination IP for assignment is" << nodeList->getDomainIP().toString();134
135 135 qDebug() << "Destination IP for assignment is" << nodeList->getDomainIP().toString();
136 // start the deployed assignment136
137 QThread* workerThread = new QThread(this);137 // start the deployed assignment
138 138 QThread* workerThread = new QThread(this);
139 connect(workerThread, SIGNAL(started()), _currentAssignment, SLOT(run()));139
140 140 connect(workerThread, SIGNAL(started()), _currentAssignment, SLOT(run()));
141 connect(_currentAssignment, SIGNAL(finished()), this, SLOT(assignmentCompleted()));141
142 connect(_currentAssignment, SIGNAL(finished()), workerThread, SLOT(quit()));142 connect(_currentAssignment, SIGNAL(finished()), this, SLOT(assignmentCompleted()));
143 connect(_currentAssignment, SIGNAL(finished()), _currentAssignment, SLOT(deleteLater()));143 connect(_currentAssignment, SIGNAL(finished()), workerThread, SLOT(quit()));
144 connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));144 connect(_currentAssignment, SIGNAL(finished()), _currentAssignment, SLOT(deleteLater()));
145 145 connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));
146 _currentAssignment->moveToThread(workerThread);146
147 147 _currentAssignment->moveToThread(workerThread);
148 // move the NodeList to the thread used for the _current assignment148
149 nodeList->moveToThread(workerThread);149 // move the NodeList to the thread used for the _current assignment
150 150 nodeList->moveToThread(workerThread);
151 // Starts an event loop, and emits workerThread->started()151
152 workerThread->start();152 // Starts an event loop, and emits workerThread->started()
153 workerThread->start();
154 } else {
155 qDebug() << "Received an assignment that could not be unpacked. Re-requesting.";
156 }
153 }157 }
154 } else {158 } else {
155 // have the NodeList attempt to handle it159 // have the NodeList attempt to handle it

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