empiredan commented on code in PR #1825:
URL:
https://github.com/apache/incubator-pegasus/pull/1825#discussion_r1444273328
##########
src/runtime/rpc/rpc_host_port.cpp:
##########
@@ -157,19 +157,28 @@ std::string host_port::to_string() const
case HOST_TYPE_IPV4:
return fmt::format("{}:{}", _host, _port);
case HOST_TYPE_GROUP:
- return fmt::format("address group {}", group_host_port()->name());
+ return fmt::format("host_port group {}", group_host_port()->name());
default:
- return "invalid address";
+ return "invalid host_port";
}
}
+// hostname has a maximum of 253 ASCII characters
+// uint_16 port maximum is 65535
+// 253 + 1(colon) + 5 = 259
+static __thread fixed_size_buffer_pool<8, 259> bf;
+const char *host_port::get_char_str() const
Review Comment:
OK. Please add some comments to illustrate our special scenarios like
`log_prefix()`:

Otherwise, using `get_char_str` by mistake may lead to some bugs:
```
// The size of hosts are more than 8.
std::vector<host_port> hosts;
......
std::vector<const char *> strs;
for (auto &e: hosts) {
strs.push_back(e.get_char_str());
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]