Skip to content

Commit

Permalink
Merge 93827b0 into 481cc3f
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuXxxx committed Mar 11, 2024
2 parents 481cc3f + 93827b0 commit aaf9a36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/pipe.cpp
Expand Up @@ -537,6 +537,11 @@ bool zmq::pipe_t::check_hwm () const
return !full;
}

bool zmq::pipe_t::is_active() const
{
return active == _state;
}

void zmq::pipe_t::send_hwms_to_peer (int inhwm_, int outhwm_)
{
if (_state == active)
Expand Down
2 changes: 2 additions & 0 deletions src/pipe.hpp
Expand Up @@ -115,6 +115,8 @@ class pipe_t ZMQ_FINAL : public object_t,
// Returns true if HWM is not reached
bool check_hwm () const;

bool is_active () const;

void set_endpoint_pair (endpoint_uri_pair_t endpoint_pair_);
const endpoint_uri_pair_t &get_endpoint_pair () const;

Expand Down
3 changes: 2 additions & 1 deletion src/router.cpp
Expand Up @@ -185,12 +185,13 @@ int zmq::router_t::xsend (msg_t *msg_)
if (!_current_out->check_write ()) {
// Check whether pipe is full or not
const bool pipe_full = !_current_out->check_hwm ();
const bool pipe_active = _current_out->is_active();
out_pipe->active = false;
_current_out = NULL;

if (_mandatory) {
_more_out = false;
if (pipe_full)
if (pipe_full && pipe_active)
errno = EAGAIN;
else
errno = EHOSTUNREACH;
Expand Down

0 comments on commit aaf9a36

Please sign in to comment.