diff --git a/src/dealer.cpp b/src/dealer.cpp index f705f6ae..2e2178e4 100644 --- a/src/dealer.cpp +++ b/src/dealer.cpp @@ -24,8 +24,7 @@ #include "msg.hpp" zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) : - socket_base_t (parent_, tid_, sid_), - prefetched (false) + socket_base_t (parent_, tid_, sid_) { options.type = ZMQ_DEALER; @@ -34,13 +33,10 @@ zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) : // If the socket is closing we can drop all the outbound requests. There'll // be noone to receive the replies anyway. // options.delay_on_close = false; - - prefetched_msg.init (); } zmq::dealer_t::~dealer_t () { - prefetched_msg.close (); } void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_) @@ -63,30 +59,12 @@ int zmq::dealer_t::xrecv (msg_t *msg_, int flags_) // flags_ is unused (void)flags_; - // If there is a prefetched message, return it. - if (prefetched) { - int rc = msg_->move (prefetched_msg); - errno_assert (rc == 0); - prefetched = false; - return 0; - } - return fq.recv (msg_); } bool zmq::dealer_t::xhas_in () { - // We may already have a message pre-fetched. - if (prefetched) - return true; - - // Try to read the next message to the pre-fetch buffer. - int rc = dealer_t::xrecv (&prefetched_msg, ZMQ_DONTWAIT); - if (rc != 0 && errno == EAGAIN) - return false; - errno_assert (rc == 0); - prefetched = true; - return true; + return fq.has_in (); } bool zmq::dealer_t::xhas_out () diff --git a/src/dealer.hpp b/src/dealer.hpp index fae3a632..b58ef880 100644 --- a/src/dealer.hpp +++ b/src/dealer.hpp @@ -62,12 +62,6 @@ namespace zmq fq_t fq; lb_t lb; - // Have we prefetched a message. - bool prefetched; - - // Holds the prefetched message. - msg_t prefetched_msg; - dealer_t (const dealer_t&); const dealer_t &operator = (const dealer_t&); };