You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "PragmaTwice (via GitHub)" <gi...@apache.org> on 2023/06/11 08:28:06 UTC

[GitHub] [incubator-kvrocks] PragmaTwice commented on a diff in pull request #1488: Feat: Block instance replication of itself and it's own replicas

PragmaTwice commented on code in PR #1488:
URL: https://github.com/apache/incubator-kvrocks/pull/1488#discussion_r1225746317


##########
src/server/server.cc:
##########
@@ -1751,3 +1751,16 @@ void Server::ResetWatchedKeys(redis::Connection *conn) {
     watched_key_size_ = watched_key_map_.size();
   }
 }
+
+std::list<std::pair<std::string, uint32_t>> Server::GetSlaveHostAndPort() {
+  std::list<std::pair<std::string, uint32_t>> result;
+  slave_threads_mu_.lock();
+  for (const auto &slave : slave_threads_) {
+    if (slave->IsStopped()) continue;
+    std::pair<std::string, int> host_port_pair = {slave->GetConn()->GetAnnounceIP(),
+                                                  slave->GetConn()->GetListeningPort()};
+    result.emplace_back(host_port_pair);
+  }
+  slave_threads_mu_.unlock();
+  return result;
+}

Review Comment:
   ```suggestion
   }
   
   ```
   
   Newline in the end of the file is expected.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org