1
0
Fork 0

correct stupid mistake: was erasing iterator in middle of same iterators loop (#3740)

This commit is contained in:
Matthew Von-Maszewski 2017-11-20 10:24:53 +01:00 committed by Jan
parent 2195ca8e35
commit 874e1d8eb0
1 changed files with 10 additions and 4 deletions

View File

@ -630,7 +630,7 @@ ClusterCommResult const ClusterComm::wait(
CoordTransactionID const coordTransactionID, communicator::Ticket const ticketId,
ShardID const& shardID, ClusterCommTimeout timeout) {
ResponseIterator i;
ResponseIterator i, i_erase;
AsyncResponse response;
ClusterCommResult return_result;
bool match_good, status_ready;
@ -648,16 +648,22 @@ ClusterCommResult const ClusterComm::wait(
status_ready=false;
if (ticketId == 0) {
i_erase = responses.end();
for (i = responses.begin(); i != responses.end() && !status_ready; i++) {
if (match(clientTransactionID, coordTransactionID, shardID, i->second.result.get())) {
match_good=true;
return_result = *i->second.result.get();
status_ready = (CL_COMM_SUBMITTED != return_result.status);
if (status_ready) {
responses.erase(i);
i_erase = i;
} // if
}
}
} // if
} // for
// only delete from list after leaving loop
if (responses.end() != i_erase) {
responses.erase(i_erase);
} // if
} else {
i = responses.find(ticketId);