2013-09-12 14:44:44 +01:00
|
|
|
/*
|
2014-01-02 12:00:57 +01:00
|
|
|
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
2013-09-12 14:44:44 +01:00
|
|
|
|
|
|
|
This file is part of 0MQ.
|
|
|
|
|
|
|
|
0MQ is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
0MQ is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "testutil.hpp"
|
|
|
|
|
2013-09-12 18:09:37 +01:00
|
|
|
static void pusher (void *ctx)
|
|
|
|
{
|
|
|
|
// Connect first
|
|
|
|
void *connectSocket = zmq_socket (ctx, ZMQ_PAIR);
|
|
|
|
assert (connectSocket);
|
2014-05-16 16:00:21 +02:00
|
|
|
int rc = zmq_connect (connectSocket, "inproc://sink");
|
2013-09-12 18:09:37 +01:00
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Queue up some data
|
|
|
|
rc = zmq_send_const (connectSocket, "foobar", 6, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
rc = zmq_close (connectSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-05-09 11:46:17 -07:00
|
|
|
static void simult_conn (void *payload)
|
|
|
|
{
|
|
|
|
// Pull out arguments - context followed by endpoint string
|
|
|
|
void* ctx = (void*)((void**)payload)[0];
|
|
|
|
char* endpt = (char*)((void**)payload)[1];
|
|
|
|
|
|
|
|
// Connect
|
|
|
|
void *connectSocket = zmq_socket (ctx, ZMQ_SUB);
|
|
|
|
assert (connectSocket);
|
|
|
|
int rc = zmq_connect (connectSocket, endpt);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
rc = zmq_close (connectSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void simult_bind (void *payload)
|
|
|
|
{
|
|
|
|
// Pull out arguments - context followed by endpoint string
|
|
|
|
void* ctx = (void*)((void**)payload)[0];
|
|
|
|
char* endpt = (char*)((void**)payload)[1];
|
|
|
|
|
|
|
|
// Bind
|
|
|
|
void *bindSocket = zmq_socket (ctx, ZMQ_PUB);
|
|
|
|
assert (bindSocket);
|
|
|
|
int rc = zmq_bind (bindSocket, endpt);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
rc = zmq_close (bindSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-02-12 23:10:23 +00:00
|
|
|
void test_bind_before_connect ()
|
2013-09-12 14:44:44 +01:00
|
|
|
{
|
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
|
|
|
|
|
|
|
// Bind first
|
|
|
|
void *bindSocket = zmq_socket (ctx, ZMQ_PAIR);
|
|
|
|
assert (bindSocket);
|
2014-05-16 16:00:21 +02:00
|
|
|
int rc = zmq_bind (bindSocket, "inproc://bbc");
|
2013-09-12 14:44:44 +01:00
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Now connect
|
|
|
|
void *connectSocket = zmq_socket (ctx, ZMQ_PAIR);
|
|
|
|
assert (connectSocket);
|
2014-05-16 16:00:21 +02:00
|
|
|
rc = zmq_connect (connectSocket, "inproc://bbc");
|
2013-09-12 14:44:44 +01:00
|
|
|
assert (rc == 0);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2013-09-12 14:44:44 +01:00
|
|
|
// Queue up some data
|
|
|
|
rc = zmq_send_const (connectSocket, "foobar", 6, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
|
|
|
|
// Read pending message
|
|
|
|
zmq_msg_t msg;
|
|
|
|
rc = zmq_msg_init (&msg);
|
|
|
|
assert (rc == 0);
|
2013-09-12 18:09:37 +01:00
|
|
|
rc = zmq_msg_recv (&msg, bindSocket, 0);
|
2013-09-12 14:44:44 +01:00
|
|
|
assert (rc == 6);
|
|
|
|
void *data = zmq_msg_data (&msg);
|
|
|
|
assert (memcmp ("foobar", data, 6) == 0);
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
rc = zmq_close (connectSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_close (bindSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-02-12 23:10:23 +00:00
|
|
|
void test_connect_before_bind ()
|
2013-09-12 14:44:44 +01:00
|
|
|
{
|
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
|
|
|
|
|
|
|
// Connect first
|
|
|
|
void *connectSocket = zmq_socket (ctx, ZMQ_PAIR);
|
|
|
|
assert (connectSocket);
|
2014-05-16 16:00:21 +02:00
|
|
|
int rc = zmq_connect (connectSocket, "inproc://cbb");
|
2013-09-12 14:44:44 +01:00
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Queue up some data
|
|
|
|
rc = zmq_send_const (connectSocket, "foobar", 6, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
|
|
|
|
// Now bind
|
|
|
|
void *bindSocket = zmq_socket (ctx, ZMQ_PAIR);
|
|
|
|
assert (bindSocket);
|
2014-05-16 16:00:21 +02:00
|
|
|
rc = zmq_bind (bindSocket, "inproc://cbb");
|
2013-09-12 14:44:44 +01:00
|
|
|
assert (rc == 0);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2013-09-12 14:44:44 +01:00
|
|
|
// Read pending message
|
|
|
|
zmq_msg_t msg;
|
|
|
|
rc = zmq_msg_init (&msg);
|
|
|
|
assert (rc == 0);
|
2013-09-12 18:09:37 +01:00
|
|
|
rc = zmq_msg_recv (&msg, bindSocket, 0);
|
2013-09-12 14:44:44 +01:00
|
|
|
assert (rc == 6);
|
|
|
|
void *data = zmq_msg_data (&msg);
|
|
|
|
assert (memcmp ("foobar", data, 6) == 0);
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
rc = zmq_close (connectSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_close (bindSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-02-12 23:10:23 +00:00
|
|
|
void test_connect_before_bind_pub_sub ()
|
2013-09-12 18:09:37 +01:00
|
|
|
{
|
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
|
|
|
|
|
|
|
// Connect first
|
|
|
|
void *connectSocket = zmq_socket (ctx, ZMQ_PUB);
|
|
|
|
assert (connectSocket);
|
2014-05-16 16:00:21 +02:00
|
|
|
int rc = zmq_connect (connectSocket, "inproc://cbbps");
|
2013-09-12 18:09:37 +01:00
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Queue up some data, this will be dropped
|
|
|
|
rc = zmq_send_const (connectSocket, "before", 6, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
|
|
|
|
// Now bind
|
|
|
|
void *bindSocket = zmq_socket (ctx, ZMQ_SUB);
|
|
|
|
assert (bindSocket);
|
|
|
|
rc = zmq_setsockopt (bindSocket, ZMQ_SUBSCRIBE, "", 0);
|
|
|
|
assert (rc == 0);
|
2014-05-16 16:00:21 +02:00
|
|
|
rc = zmq_bind (bindSocket, "inproc://cbbps");
|
2013-09-12 18:09:37 +01:00
|
|
|
assert (rc == 0);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2013-09-12 18:09:37 +01:00
|
|
|
// Wait for pub-sub connection to happen
|
2013-11-06 13:30:41 +01:00
|
|
|
msleep (SETTLE_TIME);
|
2013-09-12 18:09:37 +01:00
|
|
|
|
|
|
|
// Queue up some data, this not will be dropped
|
|
|
|
rc = zmq_send_const (connectSocket, "after", 6, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
|
|
|
|
// Read pending message
|
|
|
|
zmq_msg_t msg;
|
|
|
|
rc = zmq_msg_init (&msg);
|
|
|
|
assert (rc == 0);
|
|
|
|
rc = zmq_msg_recv (&msg, bindSocket, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
void *data = zmq_msg_data (&msg);
|
|
|
|
assert (memcmp ("after", data, 5) == 0);
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
rc = zmq_close (connectSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_close (bindSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-02-12 23:10:23 +00:00
|
|
|
void test_multiple_connects ()
|
2013-09-12 18:09:37 +01:00
|
|
|
{
|
|
|
|
const unsigned int no_of_connects = 10;
|
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
|
|
|
|
|
|
|
int rc;
|
2014-02-12 23:10:23 +00:00
|
|
|
void *connectSocket [no_of_connects];
|
2013-09-12 18:09:37 +01:00
|
|
|
|
|
|
|
// Connect first
|
|
|
|
for (unsigned int i = 0; i < no_of_connects; ++i)
|
|
|
|
{
|
|
|
|
connectSocket [i] = zmq_socket (ctx, ZMQ_PUSH);
|
|
|
|
assert (connectSocket [i]);
|
2014-05-16 16:00:21 +02:00
|
|
|
rc = zmq_connect (connectSocket [i], "inproc://multiple");
|
2013-09-12 18:09:37 +01:00
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Queue up some data
|
|
|
|
rc = zmq_send_const (connectSocket [i], "foobar", 6, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now bind
|
|
|
|
void *bindSocket = zmq_socket (ctx, ZMQ_PULL);
|
|
|
|
assert (bindSocket);
|
2014-05-16 16:00:21 +02:00
|
|
|
rc = zmq_bind (bindSocket, "inproc://multiple");
|
2013-09-12 18:09:37 +01:00
|
|
|
assert (rc == 0);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2013-09-12 18:09:37 +01:00
|
|
|
for (unsigned int i = 0; i < no_of_connects; ++i)
|
|
|
|
{
|
|
|
|
// Read pending message
|
|
|
|
zmq_msg_t msg;
|
|
|
|
rc = zmq_msg_init (&msg);
|
|
|
|
assert (rc == 0);
|
|
|
|
rc = zmq_msg_recv (&msg, bindSocket, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
void *data = zmq_msg_data (&msg);
|
|
|
|
assert (memcmp ("foobar", data, 6) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
for (unsigned int i = 0; i < no_of_connects; ++i)
|
|
|
|
{
|
|
|
|
rc = zmq_close (connectSocket [i]);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = zmq_close (bindSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-02-12 23:10:23 +00:00
|
|
|
void test_multiple_threads ()
|
2013-09-12 18:09:37 +01:00
|
|
|
{
|
2013-09-12 21:07:29 +01:00
|
|
|
const unsigned int no_of_threads = 30;
|
2013-09-12 18:09:37 +01:00
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
|
|
|
|
|
|
|
int rc;
|
|
|
|
void *threads [no_of_threads];
|
|
|
|
|
|
|
|
// Connect first
|
|
|
|
for (unsigned int i = 0; i < no_of_threads; ++i)
|
|
|
|
{
|
|
|
|
threads [i] = zmq_threadstart (&pusher, ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now bind
|
|
|
|
void *bindSocket = zmq_socket (ctx, ZMQ_PULL);
|
|
|
|
assert (bindSocket);
|
2014-05-16 16:00:21 +02:00
|
|
|
rc = zmq_bind (bindSocket, "inproc://sink");
|
2013-09-12 18:09:37 +01:00
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < no_of_threads; ++i)
|
|
|
|
{
|
|
|
|
// Read pending message
|
|
|
|
zmq_msg_t msg;
|
|
|
|
rc = zmq_msg_init (&msg);
|
|
|
|
assert (rc == 0);
|
|
|
|
rc = zmq_msg_recv (&msg, bindSocket, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
void *data = zmq_msg_data (&msg);
|
|
|
|
assert (memcmp ("foobar", data, 6) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
for (unsigned int i = 0; i < no_of_threads; ++i)
|
|
|
|
{
|
|
|
|
zmq_threadclose (threads [i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = zmq_close (bindSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-05-09 11:46:17 -07:00
|
|
|
void test_simultaneous_connect_bind_threads ()
|
|
|
|
{
|
|
|
|
const unsigned int no_of_times = 50;
|
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
|
|
|
|
|
|
|
void *threads[no_of_times*2];
|
|
|
|
void *thr_args[no_of_times][2];
|
|
|
|
char endpts[no_of_times][20];
|
|
|
|
|
|
|
|
// Set up thread arguments: context followed by endpoint string
|
|
|
|
for (unsigned int i = 0; i < no_of_times; ++i)
|
|
|
|
{
|
|
|
|
thr_args[i][0] = (void*) ctx;
|
|
|
|
thr_args[i][1] = (void*) endpts[i];
|
|
|
|
sprintf (endpts[i], "inproc://foo_%d", i);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Spawn all threads as simultaneously as possible
|
|
|
|
for (unsigned int i = 0; i < no_of_times; ++i)
|
|
|
|
{
|
|
|
|
threads[i*2+0] = zmq_threadstart (&simult_conn, (void*)thr_args[i]);
|
|
|
|
threads[i*2+1] = zmq_threadstart (&simult_bind, (void*)thr_args[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close all threads
|
|
|
|
for (unsigned int i = 0; i < no_of_times; ++i)
|
|
|
|
{
|
|
|
|
zmq_threadclose (threads[i*2+0]);
|
|
|
|
zmq_threadclose (threads[i*2+1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
int rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-02-12 23:10:23 +00:00
|
|
|
void test_identity ()
|
2013-09-12 21:07:29 +01:00
|
|
|
{
|
|
|
|
// Create the infrastructure
|
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2013-09-12 21:07:29 +01:00
|
|
|
void *sc = zmq_socket (ctx, ZMQ_DEALER);
|
|
|
|
assert (sc);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2014-05-16 16:00:21 +02:00
|
|
|
int rc = zmq_connect (sc, "inproc://identity");
|
2013-09-12 21:07:29 +01:00
|
|
|
assert (rc == 0);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2013-09-12 21:07:29 +01:00
|
|
|
void *sb = zmq_socket (ctx, ZMQ_ROUTER);
|
|
|
|
assert (sb);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2014-05-16 16:00:21 +02:00
|
|
|
rc = zmq_bind (sb, "inproc://identity");
|
2013-09-12 21:07:29 +01:00
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Send 2-part message.
|
|
|
|
rc = zmq_send (sc, "A", 1, ZMQ_SNDMORE);
|
|
|
|
assert (rc == 1);
|
|
|
|
rc = zmq_send (sc, "B", 1, 0);
|
|
|
|
assert (rc == 1);
|
|
|
|
|
|
|
|
// Identity comes first.
|
|
|
|
zmq_msg_t msg;
|
|
|
|
rc = zmq_msg_init (&msg);
|
|
|
|
assert (rc == 0);
|
|
|
|
rc = zmq_msg_recv (&msg, sb, 0);
|
|
|
|
assert (rc >= 0);
|
|
|
|
int more = zmq_msg_more (&msg);
|
|
|
|
assert (more == 1);
|
|
|
|
|
|
|
|
// Then the first part of the message body.
|
|
|
|
rc = zmq_msg_recv (&msg, sb, 0);
|
|
|
|
assert (rc == 1);
|
|
|
|
more = zmq_msg_more (&msg);
|
|
|
|
assert (more == 1);
|
|
|
|
|
|
|
|
// And finally, the second part of the message body.
|
|
|
|
rc = zmq_msg_recv (&msg, sb, 0);
|
|
|
|
assert (rc == 1);
|
|
|
|
more = zmq_msg_more (&msg);
|
|
|
|
assert (more == 0);
|
|
|
|
|
|
|
|
// Deallocate the infrastructure.
|
|
|
|
rc = zmq_close (sc);
|
|
|
|
assert (rc == 0);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
2013-09-12 21:07:29 +01:00
|
|
|
rc = zmq_close (sb);
|
|
|
|
assert (rc == 0);
|
2014-02-12 23:10:23 +00:00
|
|
|
|
|
|
|
rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void test_connect_only ()
|
|
|
|
{
|
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
|
|
|
|
|
|
|
void *connectSocket = zmq_socket (ctx, ZMQ_PUSH);
|
|
|
|
assert (connectSocket);
|
|
|
|
int rc = zmq_connect (connectSocket, "inproc://a");
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
rc = zmq_close (connectSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
|
2013-09-12 21:07:29 +01:00
|
|
|
rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2014-07-09 10:28:26 +01:00
|
|
|
|
|
|
|
void test_unbind ()
|
|
|
|
{
|
|
|
|
void *ctx = zmq_ctx_new ();
|
|
|
|
assert (ctx);
|
|
|
|
|
|
|
|
// Bind and unbind socket 1
|
|
|
|
void *bindSocket1 = zmq_socket (ctx, ZMQ_PAIR);
|
|
|
|
assert (bindSocket1);
|
|
|
|
int rc = zmq_bind (bindSocket1, "inproc://unbind");
|
|
|
|
assert (rc == 0);
|
|
|
|
zmq_unbind (bindSocket1, "inproc://unbind");
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Bind socket 2
|
|
|
|
void *bindSocket2 = zmq_socket (ctx, ZMQ_PAIR);
|
|
|
|
assert (bindSocket2);
|
|
|
|
rc = zmq_bind (bindSocket2, "inproc://unbind");
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Now connect
|
|
|
|
void *connectSocket = zmq_socket (ctx, ZMQ_PAIR);
|
|
|
|
assert (connectSocket);
|
|
|
|
rc = zmq_connect (connectSocket, "inproc://unbind");
|
|
|
|
assert (rc == 0);
|
|
|
|
|
|
|
|
// Queue up some data
|
|
|
|
rc = zmq_send_const (connectSocket, "foobar", 6, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
|
|
|
|
// Read pending message
|
|
|
|
zmq_msg_t msg;
|
|
|
|
rc = zmq_msg_init (&msg);
|
|
|
|
assert (rc == 0);
|
|
|
|
rc = zmq_msg_recv (&msg, bindSocket2, 0);
|
|
|
|
assert (rc == 6);
|
|
|
|
void *data = zmq_msg_data (&msg);
|
|
|
|
assert (memcmp ("foobar", data, 6) == 0);
|
|
|
|
|
|
|
|
// Cleanup
|
|
|
|
rc = zmq_close (connectSocket);
|
|
|
|
assert (rc == 0);
|
|
|
|
rc = zmq_close (bindSocket1);
|
|
|
|
assert (rc == 0);
|
|
|
|
rc = zmq_close (bindSocket2);
|
|
|
|
assert (rc == 0);
|
|
|
|
rc = zmq_ctx_term (ctx);
|
|
|
|
assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
2013-09-12 14:44:44 +01:00
|
|
|
int main (void)
|
|
|
|
{
|
2014-02-12 23:10:23 +00:00
|
|
|
setup_test_environment ();
|
2013-09-12 14:44:44 +01:00
|
|
|
|
2013-09-12 21:07:29 +01:00
|
|
|
test_bind_before_connect ();
|
|
|
|
test_connect_before_bind ();
|
|
|
|
test_connect_before_bind_pub_sub ();
|
|
|
|
test_multiple_connects ();
|
|
|
|
test_multiple_threads ();
|
2014-05-09 11:46:17 -07:00
|
|
|
test_simultaneous_connect_bind_threads ();
|
2013-09-12 21:07:29 +01:00
|
|
|
test_identity ();
|
2014-02-12 23:10:23 +00:00
|
|
|
test_connect_only ();
|
2014-07-09 10:28:26 +01:00
|
|
|
test_unbind ();
|
2013-09-12 14:44:44 +01:00
|
|
|
|
2013-09-12 18:09:37 +01:00
|
|
|
return 0;
|
2013-09-12 14:44:44 +01:00
|
|
|
}
|