0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-05 10:43:19 +08:00

Merge pull request #1110 from hintjens/master

Reverted removal of [ ] support
This commit is contained in:
Richard Newton 2014-06-25 15:10:07 +01:00
commit 3b505f1f6a

View File

@ -413,6 +413,11 @@ int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv6_, boo
std::string addr_str (name_, delimiter - name_);
std::string port_str (delimiter + 1);
// Remove square brackets around the address, if any, as used in IPv6
if (addr_str.size () >= 2 && addr_str [0] == '[' &&
addr_str [addr_str.size () - 1] == ']')
addr_str = addr_str.substr (1, addr_str.size () - 2);
// Allow 0 specifically, to detect invalid port error in atoi if not
uint16_t port;
if (port_str == "*" || port_str == "0")