mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 10:33:52 +01:00
Problem: assert used instead of zmq_assert
Solution: replace by zmq_assert
This commit is contained in:
parent
bafd626dff
commit
eb7b7db05d
@ -76,7 +76,7 @@ zmq::ws_listener_t::ws_listener_t (io_thread_t *io_thread_,
|
||||
#ifdef ZMQ_HAVE_WSS
|
||||
if (_wss) {
|
||||
int rc = gnutls_certificate_allocate_credentials (&_tls_cred);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
|
||||
gnutls_datum_t cert = {(unsigned char *) options_.wss_cert_pem.c_str (),
|
||||
(unsigned int) options_.wss_cert_pem.length ()};
|
||||
@ -84,7 +84,7 @@ zmq::ws_listener_t::ws_listener_t (io_thread_t *io_thread_,
|
||||
(unsigned int) options_.wss_key_pem.length ()};
|
||||
rc = gnutls_certificate_set_x509_key_mem (_tls_cred, &cert, &key,
|
||||
GNUTLS_X509_FMT_PEM);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -310,7 +310,7 @@ void zmq::ws_listener_t::create_engine (fd_t fd_)
|
||||
wss_engine_t (fd_, options, endpoint_pair, _address, false, _tls_cred,
|
||||
std::string ());
|
||||
#else
|
||||
assert (false);
|
||||
zmq_assert (false);
|
||||
#endif
|
||||
else
|
||||
engine = new (std::nothrow)
|
||||
|
@ -39,7 +39,7 @@ static int verify_certificate_callback (gnutls_session_t session)
|
||||
hostname = (const char *) gnutls_session_get_ptr (session);
|
||||
|
||||
int rc = gnutls_certificate_verify_peers3 (session, hostname, &status);
|
||||
assert (rc >= 0);
|
||||
zmq_assert (rc >= 0);
|
||||
|
||||
if (status != 0) {
|
||||
// TODO: somehow log the error
|
||||
@ -68,7 +68,7 @@ zmq::wss_engine_t::wss_engine_t (fd_t fd_,
|
||||
if (client_) {
|
||||
// TODO: move to session_base, to allow changing the socket options between connect calls
|
||||
rc = gnutls_certificate_allocate_credentials (&_tls_client_cred);
|
||||
assert (rc == 0);
|
||||
zmq_assert (rc == 0);
|
||||
|
||||
if (options_.wss_trust_system)
|
||||
gnutls_certificate_set_x509_system_trust (_tls_client_cred);
|
||||
@ -79,14 +79,14 @@ zmq::wss_engine_t::wss_engine_t (fd_t fd_,
|
||||
(unsigned int) options_.wss_trust_pem.length ()};
|
||||
rc = gnutls_certificate_set_x509_trust_mem (
|
||||
_tls_client_cred, &trust, GNUTLS_X509_FMT_PEM);
|
||||
assert (rc >= 0);
|
||||
zmq_assert (rc >= 0);
|
||||
}
|
||||
|
||||
gnutls_certificate_set_verify_function (_tls_client_cred,
|
||||
verify_certificate_callback);
|
||||
|
||||
rc = gnutls_init (&_tls_session, GNUTLS_CLIENT | GNUTLS_NONBLOCK);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
|
||||
if (!hostname_.empty ())
|
||||
gnutls_server_name_set (_tls_session, GNUTLS_NAME_DNS,
|
||||
@ -98,16 +98,16 @@ zmq::wss_engine_t::wss_engine_t (fd_t fd_,
|
||||
|
||||
rc = gnutls_credentials_set (_tls_session, GNUTLS_CRD_CERTIFICATE,
|
||||
_tls_client_cred);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
} else {
|
||||
assert (tls_server_cred_);
|
||||
zmq_assert (tls_server_cred_);
|
||||
|
||||
rc = gnutls_init (&_tls_session, GNUTLS_SERVER | GNUTLS_NONBLOCK);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
|
||||
rc = gnutls_credentials_set (_tls_session, GNUTLS_CRD_CERTIFICATE,
|
||||
tls_server_cred_);
|
||||
assert (rc == GNUTLS_E_SUCCESS);
|
||||
zmq_assert (rc == GNUTLS_E_SUCCESS);
|
||||
}
|
||||
|
||||
gnutls_set_default_priority (_tls_session);
|
||||
|
Loading…
Reference in New Issue
Block a user