mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-27 15:41:05 +08:00
test_connect_delay: don't listen on public interfaces
Tests should only bind to local interfaces. Change listening address from '*' to '127.0.0.1'. Also change instances of 'localhost' to '127.0.0.1' as used in all other tests in this directory.
This commit is contained in:
parent
a7f2ad0b24
commit
e7fda86ce2
@ -48,7 +48,7 @@ int main (void)
|
||||
val = 0;
|
||||
rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (to, "tcp://*:6555");
|
||||
rc = zmq_bind (to, "tcp://127.0.0.1:6555");
|
||||
assert (rc == 0);
|
||||
|
||||
// Create a socket pushing to two endpoints - only 1 message should arrive.
|
||||
@ -58,10 +58,10 @@ int main (void)
|
||||
val = 0;
|
||||
zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof (val));
|
||||
// This pipe will not connect
|
||||
rc = zmq_connect (from, "tcp://localhost:5556");
|
||||
rc = zmq_connect (from, "tcp://127.0.0.1:5556");
|
||||
assert (rc == 0);
|
||||
// This pipe will
|
||||
rc = zmq_connect (from, "tcp://localhost:6555");
|
||||
rc = zmq_connect (from, "tcp://127.0.0.1:6555");
|
||||
assert (rc == 0);
|
||||
|
||||
// We send 10 messages, 5 should just get stuck in the queue
|
||||
@ -107,7 +107,7 @@ int main (void)
|
||||
// Bind the valid socket
|
||||
to = zmq_socket (context, ZMQ_PULL);
|
||||
assert (to);
|
||||
rc = zmq_bind (to, "tcp://*:5560");
|
||||
rc = zmq_bind (to, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
val = 0;
|
||||
@ -128,10 +128,10 @@ int main (void)
|
||||
assert (rc == 0);
|
||||
|
||||
// Connect to the invalid socket
|
||||
rc = zmq_connect (from, "tcp://localhost:5561");
|
||||
rc = zmq_connect (from, "tcp://127.0.0.1:5561");
|
||||
assert (rc == 0);
|
||||
// Connect to the valid socket
|
||||
rc = zmq_connect (from, "tcp://localhost:5560");
|
||||
rc = zmq_connect (from, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
// Send 10 messages, all should be routed to the connected pipe
|
||||
@ -181,9 +181,9 @@ int main (void)
|
||||
int on = 1;
|
||||
rc = zmq_setsockopt (frontend, ZMQ_DELAY_ATTACH_ON_CONNECT, &on, sizeof (on));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (backend, "tcp://*:5560");
|
||||
rc = zmq_bind (backend, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
rc = zmq_connect (frontend, "tcp://localhost:5560");
|
||||
rc = zmq_connect (frontend, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
// Ping backend to frontend so we know when the connection is up
|
||||
@ -213,7 +213,7 @@ int main (void)
|
||||
assert (backend);
|
||||
rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (backend, "tcp://*:5560");
|
||||
rc = zmq_bind (backend, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
// Ping backend to frontend so we know when the connection is up
|
||||
|
Loading…
x
Reference in New Issue
Block a user