From 7fbd97718457adeaabe904dfea38a2b18d445165 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Mon, 11 Feb 2019 11:23:48 -0500 Subject: [PATCH] Problem: assertion triggered in stream_connecter_base::close Solution: change into regular control flow condition --- src/stream_connecter_base.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/stream_connecter_base.cpp b/src/stream_connecter_base.cpp index bf7db348..f54ad195 100644 --- a/src/stream_connecter_base.cpp +++ b/src/stream_connecter_base.cpp @@ -130,17 +130,19 @@ void zmq::stream_connecter_base_t::rm_handle () void zmq::stream_connecter_base_t::close () { - zmq_assert (_s != retired_fd); + // TODO before, this was an assertion for _s != retired_fd, but this does not match usage of close + if (_s != retired_fd) { #ifdef ZMQ_HAVE_WINDOWS - const int rc = closesocket (_s); - wsa_assert (rc != SOCKET_ERROR); + const int rc = closesocket (_s); + wsa_assert (rc != SOCKET_ERROR); #else - const int rc = ::close (_s); - errno_assert (rc == 0); + const int rc = ::close (_s); + errno_assert (rc == 0); #endif - _socket->event_closed (make_unconnected_connect_endpoint_pair (_endpoint), - _s); - _s = retired_fd; + _socket->event_closed ( + make_unconnected_connect_endpoint_pair (_endpoint), _s); + _s = retired_fd; + } } void zmq::stream_connecter_base_t::in_event ()