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

[GitHub] [kvrocks] xiaofan8421 commented on a diff in pull request #1763: Fix wrong replica's port number(=0) if the listening port is not set

xiaofan8421 commented on code in PR #1763:
URL: https://github.com/apache/kvrocks/pull/1763#discussion_r1328279438


##########
src/server/redis_connection.h:
##########
@@ -93,6 +93,7 @@ class Connection : public EvbufCallbackBase<Connection> {
   int GetListeningPort() const { return listening_port_; }
   void SetAnnounceIP(std::string ip) { announce_ip_ = std::move(ip); }
   std::string GetAnnounceIP() const { return !announce_ip_.empty() ? announce_ip_ : ip_; }
+  uint32_t GetAnnouncePort() const { return listening_port_ != 0 ? listening_port_ : port_; }
   std::string GetAnnounceAddr() const { return GetAnnounceIP() + ":" + std::to_string(listening_port_); }

Review Comment:
   I had the same idea two days ago, but I am not very familiar with Kvrcoks source code. I have been new to Kvrocks for almost 2 months. I'm not sure if I fix GetAnnounceAddr, other calls will have a side effect or not. So I only added GetAnnouncePort for securely in case of bad import.



-- 
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