| 363 | } |
| 364 | |
| 365 | redis::Connection *Worker::removeConnection(int fd) { |
| 366 | redis::Connection *conn = nullptr; |
| 367 | |
| 368 | std::unique_lock<std::mutex> lock(conns_mu_); |
| 369 | auto iter = conns_.find(fd); |
| 370 | if (iter != conns_.end()) { |
| 371 | conn = iter->second; |
| 372 | conns_.erase(iter); |
| 373 | srv->DecrClientNum(); |
| 374 | } |
| 375 | |
| 376 | iter = monitor_conns_.find(fd); |
| 377 | if (iter != monitor_conns_.end()) { |
| 378 | conn = iter->second; |
| 379 | monitor_conns_.erase(iter); |
| 380 | srv->DecrClientNum(); |
| 381 | srv->DecrMonitorClientNum(); |
| 382 | } |
| 383 | |
| 384 | return conn; |
| 385 | } |
| 386 | |
| 387 | // MigrateConnection moves the connection to another worker |
| 388 | // when reducing the number of workers. |
nothing calls this directly
no test coverage detected