Commit 13b972b2 authored by sigiesec's avatar sigiesec Committed by Giesecke

Problem: no tests without ZAP handler where one is expected

Solution: added test case for NULL/PLAIN/CURVE
parent 9071265c
......@@ -266,6 +266,20 @@ void test_zap_errors (socket_config_fn server_socket_config_,
client_socket_config_data_);
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
handler);
// no ZAP handler
fprintf (stderr, "test_zap_unsuccessful no ZAP handler started\n");
setup_context_and_server_side (
&ctx, &handler, &zap_thread, &server, &server_mon, my_endpoint,
NULL, server_socket_config_);
test_zap_unsuccessful (ctx, my_endpoint, server, server_mon,
#ifdef ZMQ_BUILD_DRAFT_API
ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL, EFAULT,
#else
0, 0,
#endif
client_socket_config_, client_socket_config_data_);
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
handler);
}
int main (void)
......
......@@ -336,12 +336,15 @@ void setup_context_and_server_side (
int rc = zmq_bind (*handler, "inproc://handler-control");
assert (rc == 0);
*zap_thread = zmq_threadstart (zap_handler_, *ctx);
if (zap_handler_) {
*zap_thread = zmq_threadstart (zap_handler_, *ctx);
char *buf = s_recv (*handler);
assert (buf);
assert (streq (buf, "GO"));
free (buf);
char *buf = s_recv (*handler);
assert (buf);
assert (streq (buf, "GO"));
free (buf);
} else
*zap_thread = NULL;
// Server socket will accept connections
*server = zmq_socket (*ctx, ZMQ_DEALER);
......@@ -386,7 +389,8 @@ void shutdown_context_and_server_side (void *ctx,
close_zero_linger (server);
// Wait until ZAP handler terminates
zmq_threadclose (zap_thread);
if (zap_thread)
zmq_threadclose (zap_thread);
rc = zmq_ctx_term (ctx);
assert (rc == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment