diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index bd7f1436..920d5956 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -790,8 +790,10 @@ int zmq::stream_engine_t::next_handshake_command (msg_t *msg_) if (rc == 0) msg_->set_flags (msg_t::command); +#ifdef ZMQ_BUILD_DRAFT_API if(mechanism->status() == mechanism_t::error) socket->event_handshake_failed(endpoint, 0); +#endif return rc; } @@ -871,7 +873,9 @@ void zmq::stream_engine_t::mechanism_ready () if (!properties.empty ()) metadata = new (std::nothrow) metadata_t (properties); +#ifdef ZMQ_BUILD_DRAFT_API socket->event_handshake_succeed(endpoint, 0); +#endif } int zmq::stream_engine_t::pull_msg_from_session (msg_t *msg_) @@ -976,8 +980,10 @@ void zmq::stream_engine_t::error (error_reason_t reason) terminator.close(); } zmq_assert (session); +#ifdef ZMQ_BUILD_DRAFT_API if(reason == encryption_error) socket->event_handshake_failed(endpoint, (int) s); +#endif socket->event_disconnected (endpoint, (int) s); session->flush (); session->engine_error (reason); diff --git a/tests/test_monitor.cpp b/tests/test_monitor.cpp index d79fd36b..144dfd10 100644 --- a/tests/test_monitor.cpp +++ b/tests/test_monitor.cpp @@ -116,6 +116,10 @@ int main (void) if (event == ZMQ_EVENT_CONNECT_DELAYED) event = get_monitor_event (client_mon, NULL, NULL); assert (event == ZMQ_EVENT_CONNECTED); +#ifdef ZMQ_BUILD_DRAFT_API + event = get_monitor_event (client_mon, NULL, NULL); + assert (event == ZMQ_EVENT_HANDSHAKE_SUCCEED); +#endif event = get_monitor_event (client_mon, NULL, NULL); assert (event == ZMQ_EVENT_MONITOR_STOPPED); @@ -124,6 +128,10 @@ int main (void) assert (event == ZMQ_EVENT_LISTENING); event = get_monitor_event (server_mon, NULL, NULL); assert (event == ZMQ_EVENT_ACCEPTED); +#ifdef ZMQ_BUILD_DRAFT_API + event = get_monitor_event (server_mon, NULL, NULL); + assert (event == ZMQ_EVENT_HANDSHAKE_SUCCEED); +#endif event = get_monitor_event (server_mon, NULL, NULL); // Sometimes the server sees the client closing before it gets closed. if (event != ZMQ_EVENT_DISCONNECTED) {