| 687 | } |
| 688 | |
| 689 | void ReactorThread::DestroyConnection(Connection* conn, |
| 690 | const Status& conn_status, |
| 691 | unique_ptr<ErrorStatusPB> rpc_error) { |
| 692 | DCHECK(IsCurrentThread()); |
| 693 | |
| 694 | conn->Shutdown(conn_status, std::move(rpc_error)); |
| 695 | |
| 696 | // Unlink connection from lists. |
| 697 | if (conn->direction() == Connection::CLIENT) { |
| 698 | const auto range = client_conns_.equal_range(conn->outbound_connection_id()); |
| 699 | CHECK(range.first != range.second) << "Couldn't find connection " << conn->ToString(); |
| 700 | // The client_conns_ container is a multi-map. |
| 701 | for (auto it = range.first; it != range.second;) { |
| 702 | if (it->second.get() == conn) { |
| 703 | it = client_conns_.erase(it); |
| 704 | break; |
| 705 | } |
| 706 | ++it; |
| 707 | } |
| 708 | } else if (conn->direction() == Connection::SERVER) { |
| 709 | auto it = server_conns_.begin(); |
| 710 | while (it != server_conns_.end()) { |
| 711 | if ((*it).get() == conn) { |
| 712 | server_conns_.erase(it); |
| 713 | break; |
| 714 | } |
| 715 | ++it; |
| 716 | } |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | DelayedTask::DelayedTask(std::function<void(const Status&)> func, |
| 721 | MonoDelta when) |
no test coverage detected