Commit ae386d42 authored by Jakob Otto's avatar Jakob Otto

Fix to_string

parent ff277dce
...@@ -37,8 +37,20 @@ long ipv6_endpoint::compare(ipv6_endpoint x) const noexcept { ...@@ -37,8 +37,20 @@ long ipv6_endpoint::compare(ipv6_endpoint x) const noexcept {
return res == 0 ? port_ - x.port() : res; return res == 0 ? port_ - x.port() : res;
} }
std::string to_string(const ipv6_endpoint& ep) { std::string to_string(const ipv6_endpoint& x) {
return "[" + to_string(ep.address()) + "]:" + std::to_string(ep.port()); std::string result;
auto addr = x.address();
if (addr.embeds_v4()) {
result += to_string(x);
result += ":";
result += std::to_string(x.port());
} else {
result += '[';
result += to_string(addr);
result += "]:";
result += std::to_string(x.port());
}
return result;
} }
} // namespace caf } // namespace caf
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment