Add missing cancel callback for delayed call.

And make the function a little neater.
This commit is contained in:
Niclas Antti
2018-09-25 17:49:09 +03:00
parent ddd6feff69
commit 1063b4a6be

View File

@ -1013,23 +1013,19 @@ bool Worker::cancel_delayed_call(uint32_t id)
// Not particularly likely there will be many of those. // Not particularly likely there will be many of those.
auto range = m_sorted_calls.equal_range(pCall->at()); auto range = m_sorted_calls.equal_range(pCall->at());
auto k = range.first; mxb_assert(range.first != range.second);
mxb_assert(k != range.second);
while (k != range.second) for (auto k = range.first; k != range.second; ++k)
{ {
if (k->second == pCall) if (k->second == pCall)
{ {
m_sorted_calls.erase(k); m_sorted_calls.erase(k);
pCall->call(Worker::Call::CANCEL);
delete pCall; delete pCall;
k = range.second;
found = true; found = true;
} break;
else
{
++k;
} }
} }