diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/socket_base.cpp | 10 | ||||
-rw-r--r-- | src/zmq.cpp | 19 |
2 files changed, 23 insertions, 6 deletions
diff --git a/src/socket_base.cpp b/src/socket_base.cpp index ced28d4..302003f 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -485,6 +485,9 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_) if (unlikely (rc != 0)) return -1; + // Clear any user-visible flags that are set on the message. + msg_->reset_flags (msg_t::more); + // At this point we impose the flags on the message. if (flags_ & ZMQ_SNDMORE) msg_->set_flags (msg_t::more); @@ -857,15 +860,10 @@ void zmq::socket_base_t::terminated (pipe_t *pipe_) void zmq::socket_base_t::extract_flags (msg_t *msg_) { // Test whether IDENTITY flag is valid for this socket type. - if (unlikely (msg_->flags () & msg_t::identity)) { + if (unlikely (msg_->flags () & msg_t::identity)) zmq_assert (options.recv_identity); -printf ("identity recvd\n"); - } - // Remove MORE flag. rcvmore = msg_->flags () & msg_t::more ? true : false; - if (rcvmore) - msg_->reset_flags (msg_t::more); } diff --git a/src/zmq.cpp b/src/zmq.cpp index b06b122..84dcdd1 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -340,6 +340,25 @@ size_t zmq_msg_size (zmq_msg_t *msg_) return ((zmq::msg_t*) msg_)->size (); } +int zmq_getmsgopt (zmq_msg_t *msg_, int option_, void *optval_, + size_t *optvallen_) +{ + switch (option_) { + case ZMQ_MORE: + if (*optvallen_ < sizeof (int)) { + errno = EINVAL; + return -1; + } + *((int*) optval_) = + (((zmq::msg_t*) msg_)->flags () & zmq::msg_t::more) ? 1 : 0; + *optvallen_ = sizeof (int); + return 0; + default: + errno = EINVAL; + return -1; + } +} + int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) { #if defined ZMQ_POLL_BASED_ON_POLL |