| 562 | } |
| 563 | |
| 564 | void Server::SSubscribeChannel(const std::string &channel, redis::Connection *conn, uint16_t slot) { |
| 565 | assert((config_->cluster_enabled && slot < HASH_SLOTS_SIZE) || slot == 0); |
| 566 | std::lock_guard<std::mutex> guard(pubsub_shard_channels_mu_); |
| 567 | |
| 568 | auto conn_ctx = ConnContext(conn->Owner(), conn->GetFD()); |
| 569 | if (auto iter = pubsub_shard_channels_[slot].find(channel); iter == pubsub_shard_channels_[slot].end()) { |
| 570 | pubsub_shard_channels_[slot].emplace(channel, std::list<ConnContext>{conn_ctx}); |
| 571 | } else { |
| 572 | iter->second.emplace_back(conn_ctx); |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | void Server::SUnsubscribeChannel(const std::string &channel, redis::Connection *conn, uint16_t slot) { |
| 577 | assert((config_->cluster_enabled && slot < HASH_SLOTS_SIZE) || slot == 0); |
no test coverage detected