MCPcopy Create free account
hub / github.com/apache/kvrocks / removeConnection

Method removeConnection

src/server/worker.cc:365–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365redis::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.

Callers

nothing calls this directly

Calls 3

endMethod · 0.80
DecrClientNumMethod · 0.80
DecrMonitorClientNumMethod · 0.80

Tested by

no test coverage detected