Skip to content

Commit 959a133

Browse files
authored
Fixing SEGV #4524. Pipe should only send to peer when active. (#4647)
* Fixing SEGV #4524. Pipe should only send to peer when active.
1 parent 86a42e1 commit 959a133

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/pipe.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,8 @@ bool zmq::pipe_t::check_hwm () const
539539

540540
void zmq::pipe_t::send_hwms_to_peer (int inhwm_, int outhwm_)
541541
{
542-
send_pipe_hwm (_peer, inhwm_, outhwm_);
542+
if (_state == active)
543+
send_pipe_hwm (_peer, inhwm_, outhwm_);
543544
}
544545

545546
void zmq::pipe_t::set_endpoint_pair (zmq::endpoint_uri_pair_t endpoint_pair_)
@@ -554,10 +555,12 @@ const zmq::endpoint_uri_pair_t &zmq::pipe_t::get_endpoint_pair () const
554555

555556
void zmq::pipe_t::send_stats_to_peer (own_t *socket_base_)
556557
{
557-
endpoint_uri_pair_t *ep =
558-
new (std::nothrow) endpoint_uri_pair_t (_endpoint_pair);
559-
send_pipe_peer_stats (_peer, _msgs_written - _peers_msgs_read, socket_base_,
560-
ep);
558+
if (_state == active) {
559+
endpoint_uri_pair_t *ep =
560+
new (std::nothrow) endpoint_uri_pair_t (_endpoint_pair);
561+
send_pipe_peer_stats (_peer, _msgs_written - _peers_msgs_read,
562+
socket_base_, ep);
563+
}
561564
}
562565

563566
void zmq::pipe_t::process_pipe_peer_stats (uint64_t queue_count_,

0 commit comments

Comments
 (0)