mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-15 10:18:01 +08:00
Merge pull request #44 from c-rack/fix-ipv6-resolve
Solution: allow brackets in tcp address. Fixes #43
This commit is contained in:
commit
3869d7d490
@ -603,11 +603,12 @@ int zmq::socket_base_t::connect (const char *addr_)
|
|||||||
// Following code is quick and dirty check to catch obvious errors,
|
// Following code is quick and dirty check to catch obvious errors,
|
||||||
// without trying to be fully accurate.
|
// without trying to be fully accurate.
|
||||||
const char *check = address.c_str ();
|
const char *check = address.c_str ();
|
||||||
if (isalnum (*check) || isxdigit (*check)) {
|
if (isalnum (*check) || isxdigit (*check) || *check == '[') {
|
||||||
check++;
|
check++;
|
||||||
while (isalnum (*check)
|
while (isalnum (*check)
|
||||||
|| isxdigit (*check)
|
|| isxdigit (*check)
|
||||||
|| *check == '.' || *check == '-' || *check == ':'|| *check == ';')
|
|| *check == '.' || *check == '-' || *check == ':'|| *check == ';'
|
||||||
|
|| *check == ']')
|
||||||
check++;
|
check++;
|
||||||
}
|
}
|
||||||
// Assume the worst, now look for success
|
// Assume the worst, now look for success
|
||||||
|
@ -41,6 +41,9 @@ int main (void)
|
|||||||
int rc = zmq_connect (sock, "tcp://localhost:1234");
|
int rc = zmq_connect (sock, "tcp://localhost:1234");
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
|
|
||||||
|
rc = zmq_connect (sock, "tcp://[::1]:4506");
|
||||||
|
assert (rc == 0);
|
||||||
|
|
||||||
rc = zmq_connect (sock, "tcp://localhost:invalid");
|
rc = zmq_connect (sock, "tcp://localhost:invalid");
|
||||||
assert (rc == -1);
|
assert (rc == -1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user