Source release v3.0.1 + third_party
This commit is contained in:
@@ -91,3 +91,20 @@ void TestHost::setTimeout(int64_t delay_ms,
|
||||
int64_t expiry_time = now_ + delay_ms;
|
||||
timers_.push(Timer(expiry_time, client, context));
|
||||
}
|
||||
|
||||
void TestHost::cancel(IClient* client) {
|
||||
// Filter out the timers for this client and put the rest into |others|.
|
||||
std::priority_queue<Timer> others;
|
||||
|
||||
while (timers_.size()) {
|
||||
Timer t = timers_.top();
|
||||
timers_.pop();
|
||||
|
||||
if (t.client != client) {
|
||||
others.push(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Now swap the queues.
|
||||
timers_.swap(others);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user