From 2e3360c4978246a4449488f4b2cd09561f91f3d4 Mon Sep 17 00:00:00 2001 From: ZhuXxxx <129362466+ZhuXxxx@users.noreply.github.com> Date: Mon, 11 Mar 2024 18:20:50 +0800 Subject: [PATCH 1/3] Update pipe.cpp --- src/pipe.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pipe.cpp b/src/pipe.cpp index 181fe87832..d64f026d26 100644 --- a/src/pipe.cpp +++ b/src/pipe.cpp @@ -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) From 5db878ebad552c9569cbaa1da7e8e5829b6ef015 Mon Sep 17 00:00:00 2001 From: ZhuXxxx <129362466+ZhuXxxx@users.noreply.github.com> Date: Mon, 11 Mar 2024 18:22:09 +0800 Subject: [PATCH 2/3] Update pipe.hpp --- src/pipe.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pipe.hpp b/src/pipe.hpp index b5bc51e1e3..ace3f2e3eb 100644 --- a/src/pipe.hpp +++ b/src/pipe.hpp @@ -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; From 93827b020a1a8c6c11ece8cd8644ab9475d18a61 Mon Sep 17 00:00:00 2001 From: ZhuXxxx <129362466+ZhuXxxx@users.noreply.github.com> Date: Mon, 11 Mar 2024 18:23:30 +0800 Subject: [PATCH 3/3] Update router.cpp --- src/router.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/router.cpp b/src/router.cpp index 53ec17c9d3..df4743b28d 100644 --- a/src/router.cpp +++ b/src/router.cpp @@ -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;