]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/msg/msg_types.cc
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / msg / msg_types.cc
index 1a78cb32680986285d882b15d3d92742eab622e7..d4114b06e5975cf20a45acf8d9e78f43c69a710a 100644 (file)
@@ -8,6 +8,8 @@
 #include <string.h>
 #include <netdb.h>
 
+#include <fmt/format.h>
+
 #include "common/Formatter.h"
 
 bool entity_name_t::parse(std::string_view s)
@@ -413,13 +415,9 @@ std::string entity_addr_t::ip_only_to_str() const
 
 std::string entity_addr_t::ip_n_port_to_str() const
 {
-  std::string addr;
-  addr += ip_only_to_str();
   if (is_ipv6()) {
-    addr = '[' + addr + ']';
+    return fmt::format("[{}]:{}", ip_only_to_str(), get_port());
+  } else {
+    return fmt::format("{}:{}", ip_only_to_str(), get_port());
   }
-  addr += ':';
-  addr += std::to_string(get_port());
-  return addr;
 }
-