| 594 | |
| 595 | |
| 596 | void remove_by_client(const C& client, |
| 597 | bool reverse = false, |
| 598 | std::function<void (RequestRef&&)> accum = request_sink) { |
| 599 | DataGuard g(data_mtx); |
| 600 | |
| 601 | auto i = client_map.find(client); |
| 602 | |
| 603 | if (i == client_map.end()) return; |
| 604 | |
| 605 | if (reverse) { |
| 606 | for (auto j = i->second->requests.rbegin(); |
| 607 | j != i->second->requests.rend(); |
| 608 | ++j) { |
| 609 | accum(std::move(j->request)); |
| 610 | } |
| 611 | } else { |
| 612 | for (auto j = i->second->requests.begin(); |
| 613 | j != i->second->requests.end(); |
| 614 | ++j) { |
| 615 | accum(std::move(j->request)); |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | i->second->requests.clear(); |
| 620 | |
| 621 | resv_heap.adjust(*i->second); |
| 622 | limit_heap.adjust(*i->second); |
| 623 | ready_heap.adjust(*i->second); |
| 624 | #if USE_PROP_HEAP |
| 625 | prop_heap.adjust(*i->second); |
| 626 | #endif |
| 627 | } |
| 628 | |
| 629 | |
| 630 | unsigned get_heap_branching_factor() const { |