1
0
Fork 0

Fix bug that callback was not called for singleRequest case in ClusterComm.

This commit is contained in:
Max Neunhoeffer 2016-03-21 23:00:44 +01:00
parent 47e5069bf7
commit cc76ffc5d2
1 changed files with 22 additions and 0 deletions

View File

@ -1126,6 +1126,28 @@ void ClusterCommThread::run() {
}
}
if (op->result.single) {
// For single requests this is it, either it worked and is ready
// or there was an error (timeout or other). If there is a callback,
// we have to call it now:
if (nullptr != op->callback.get()) {
if (op->result.status == CL_COMM_SENDING) {
op->result.status = CL_COMM_SENT;
}
if ((*op->callback.get())(&op->result)) {
// This is fully processed, so let's remove it from the queue:
CONDITION_LOCKER(locker, cc->somethingToSend);
auto i = cc->toSendByOpID.find(op->result.operationID);
TRI_ASSERT(i != cc->toSendByOpID.end());
auto q = i->second;
cc->toSendByOpID.erase(i);
cc->toSend.erase(q);
delete op;
continue; // do not move to the received queue but forget it
}
}
}
cc->moveFromSendToReceived(op->result.operationID);
// Potentially it was dropped in the meantime, then we forget about it.
}