| 450 | } |
| 451 | |
| 452 | void Worker::FreeConnectionByID(int fd, uint64_t id) { |
| 453 | std::unique_lock<std::mutex> lock(conns_mu_); |
| 454 | auto iter = conns_.find(fd); |
| 455 | if (iter != conns_.end() && iter->second->GetID() == id) { |
| 456 | if (rate_limit_group_ != nullptr) { |
| 457 | bufferevent_remove_from_rate_limit_group(iter->second->GetBufferEvent()); |
| 458 | } |
| 459 | delete iter->second; |
| 460 | conns_.erase(iter); |
| 461 | srv->DecrClientNum(); |
| 462 | } |
| 463 | |
| 464 | iter = monitor_conns_.find(fd); |
| 465 | if (iter != monitor_conns_.end() && iter->second->GetID() == id) { |
| 466 | delete iter->second; |
| 467 | monitor_conns_.erase(iter); |
| 468 | srv->DecrClientNum(); |
| 469 | srv->DecrMonitorClientNum(); |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | Status Worker::EnableWriteEvent(int fd) { |
| 474 | std::unique_lock<std::mutex> lock(conns_mu_); |
nothing calls this directly
no test coverage detected