mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-27 11:06:52 +01:00
Added test_metadata
- also prioritize ZAP metadata over ZMTP metadata in case application uses same names.
This commit is contained in:
@@ -78,19 +78,19 @@ int main (void)
|
||||
|
||||
// We bounce between a binding server and a connecting client
|
||||
|
||||
// // We first test client/server with no ZAP domain
|
||||
// // Libzmq does not call our ZAP handler, the connect must succeed
|
||||
// void *server = zmq_socket (ctx, ZMQ_DEALER);
|
||||
// assert (server);
|
||||
// void *client = zmq_socket (ctx, ZMQ_DEALER);
|
||||
// assert (client);
|
||||
// rc = zmq_bind (server, "tcp://127.0.0.1:9000");
|
||||
// assert (rc == 0);
|
||||
// rc = zmq_connect (client, "tcp://127.0.0.1:9000");
|
||||
// assert (rc == 0);
|
||||
// bounce (server, client);
|
||||
// close_zero_linger (client);
|
||||
// close_zero_linger (server);
|
||||
// We first test client/server with no ZAP domain
|
||||
// Libzmq does not call our ZAP handler, the connect must succeed
|
||||
void *server = zmq_socket (ctx, ZMQ_DEALER);
|
||||
assert (server);
|
||||
void *client = zmq_socket (ctx, ZMQ_DEALER);
|
||||
assert (client);
|
||||
rc = zmq_bind (server, "tcp://127.0.0.1:9000");
|
||||
assert (rc == 0);
|
||||
rc = zmq_connect (client, "tcp://127.0.0.1:9000");
|
||||
assert (rc == 0);
|
||||
bounce (server, client);
|
||||
close_zero_linger (client);
|
||||
close_zero_linger (server);
|
||||
|
||||
// Now define a ZAP domain for the server; this enables
|
||||
// authentication. We're using the wrong domain so this test
|
||||
@@ -109,20 +109,20 @@ int main (void)
|
||||
close_zero_linger (client);
|
||||
close_zero_linger (server);
|
||||
|
||||
// // Now use the right domain, the test must pass
|
||||
// server = zmq_socket (ctx, ZMQ_DEALER);
|
||||
// assert (server);
|
||||
// client = zmq_socket (ctx, ZMQ_DEALER);
|
||||
// assert (client);
|
||||
// rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 4);
|
||||
// assert (rc == 0);
|
||||
// rc = zmq_bind (server, "tcp://127.0.0.1:9002");
|
||||
// assert (rc == 0);
|
||||
// rc = zmq_connect (client, "tcp://127.0.0.1:9002");
|
||||
// assert (rc == 0);
|
||||
// bounce (server, client);
|
||||
// close_zero_linger (client);
|
||||
// close_zero_linger (server);
|
||||
// Now use the right domain, the test must pass
|
||||
server = zmq_socket (ctx, ZMQ_DEALER);
|
||||
assert (server);
|
||||
client = zmq_socket (ctx, ZMQ_DEALER);
|
||||
assert (client);
|
||||
rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 4);
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (server, "tcp://127.0.0.1:9002");
|
||||
assert (rc == 0);
|
||||
rc = zmq_connect (client, "tcp://127.0.0.1:9002");
|
||||
assert (rc == 0);
|
||||
bounce (server, client);
|
||||
close_zero_linger (client);
|
||||
close_zero_linger (server);
|
||||
|
||||
// Shutdown
|
||||
rc = zmq_ctx_term (ctx);
|
||||
|
||||
Reference in New Issue
Block a user