This commit is contained in:
Sergey Kovalevich 2015-11-20 13:15:11 +03:00
parent c100ad1dc0
commit cb47f02f42
2 changed files with 5 additions and 5 deletions

View File

@ -1234,12 +1234,12 @@ int zmq::socket_base_t::monitor (const char *addr_, int events_)
int linger = 0;
int rc = zmq_setsockopt (monitor_socket, ZMQ_LINGER, &linger, sizeof (linger));
if (rc == -1)
stop_monitor ();
stop_monitor (false);
// Spawn the monitor socket endpoint
rc = zmq_bind (monitor_socket, addr_);
if (rc == -1)
stop_monitor ();
stop_monitor (false);
return rc;
}
@ -1332,10 +1332,10 @@ void zmq::socket_base_t::monitor_event (int event_, int value_, const std::strin
}
}
void zmq::socket_base_t::stop_monitor (void)
void zmq::socket_base_t::stop_monitor (bool send_monitor_stopped_event_)
{
if (monitor_socket) {
if (monitor_events & ZMQ_EVENT_MONITOR_STOPPED)
if ((monitor_events & ZMQ_EVENT_MONITOR_STOPPED) && send_monitor_stopped_event_)
monitor_event (ZMQ_EVENT_MONITOR_STOPPED, 0, "");
zmq_close (monitor_socket);
monitor_socket = NULL;

View File

@ -173,7 +173,7 @@ namespace zmq
void monitor_event (int event_, int value_, const std::string& addr_);
// Monitor socket cleanup
void stop_monitor ();
void stop_monitor (bool send_monitor_stopped_event_ = true);
// Next assigned name on a zmq_connect() call used by ROUTER and STREAM socket types
std::string connect_rid;