Problem: ZAP status codes != 200 do not result in an appropriate monitor event (#2665)

* Problem: missing test for status code 300, inadequate assertion for status code 500

Solution: add test, change assertion (currently test fails)

* Problem: gcc compiler error deprecated conversion from string constant

Solution: declare variable as const

* Problem: in case of ZAP handler returning a status code other than 200, no appropriate event is emitted

Solution: immediately emit event after receiving reply from ZAP handler

* Problem: endpoint address is not included in zap-reply monitor event

Solution: added functions to retrieve endpoint address in zmq::i_engine and zmq::session_base_t
removed unused code block in zmq::stream_engine_t::next_handshake_command

* Problem: wrong formatting

Solution: fix formatting

* Problem: test fails because of EPIPE

Solution: add EPIPE/ECONNRESET/ECONNAGAIN handling for more test cases
This commit is contained in:
Simon Giesecke
2017-08-08 14:10:20 +02:00
committed by Luca Boccassi
parent 834b9e4cd7
commit a6cef4ef86
10 changed files with 112 additions and 45 deletions

View File

@@ -784,19 +784,6 @@ 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) {
int err = errno;
if (mechanism->error_detail () == mechanism_t::zmtp)
socket->event_handshake_failed_zmtp (endpoint, err);
else if (mechanism->error_detail () == mechanism_t::zap)
socket->event_handshake_failed_zap (endpoint, err);
else if (mechanism->error_detail () == mechanism_t::encryption)
socket->event_handshake_failed_encryption (endpoint, err);
else
socket->event_handshake_failed_no_detail (endpoint, err);
}
#endif
return rc;
}
@@ -836,6 +823,11 @@ void zmq::stream_engine_t::zap_msg_available ()
restart_output ();
}
const char *zmq::stream_engine_t::get_endpoint () const
{
return endpoint.c_str ();
}
void zmq::stream_engine_t::mechanism_ready ()
{
if (options.heartbeat_interval > 0) {