Skip to content

Commit

Permalink
allow setting server id 0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Fei Chen authored and facebook-github-bot committed Sep 5, 2024
1 parent 107203b commit b997e90
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions katran/tpr/TcpPktRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ folly::Expected<folly::Unit, std::system_error> 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();
Expand All @@ -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;
Expand Down

0 comments on commit b997e90

Please sign in to comment.