From b997e90c67b66ab46fb6c2f6d9c122910c405c95 Mon Sep 17 00:00:00 2001 From: Fei Chen Date: Thu, 5 Sep 2024 07:14:10 -0700 Subject: [PATCH] allow setting server id 0 Summary: also issue a warning message and return if the new id is same as the previous one. Reviewed By: avasylev Differential Revision: D62184091 fbshipit-source-id: e9a887bb7b59f592fa4ada1ec51ff3d1acb2d591 --- katran/tpr/TcpPktRouter.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/katran/tpr/TcpPktRouter.cpp b/katran/tpr/TcpPktRouter.cpp index 82e8ef2a3..6f476d724 100644 --- a/katran/tpr/TcpPktRouter.cpp +++ b/katran/tpr/TcpPktRouter.cpp @@ -108,12 +108,13 @@ folly::Expected TcpPktRouter::shutdown() { bool TcpPktRouter::setServerIdV6(uint32_t id) { CHECK_EQ(mode_, RunningMode::SERVER); - if (id == 0) { - return false; - } if (id > kMaxServerId) { return false; } + if (v6Id_ == id) { + LOG(WARNING) << "Server id is already set to " << id; + return true; + } v6Id_ = id; if (isInitialized_) { updateServerInfo(); @@ -129,8 +130,8 @@ TcpPktRouter::updateServerInfo() noexcept { info.kde_enabled = kdeEnabled_; info.server_id = v6Id_; if (info.server_id == 0) { - LOG(ERROR) << "TCP Pkt router is set but server_id is 0. Please check " - "if the id has been set properly."; + LOG(WARNING) << "TCP Pkt router is set but server_id is 0. Please check " + "if the id has been set properly."; } } else { info.running_mode = RunningMode::CLIENT;