Commit 648e3199 authored by Ian Barber's avatar Ian Barber

Merge pull request #325 from hurtonm/update_comment_in_device_plus_whitespace_fixes

Mention limitation of the device implementation
parents e8b701cb a2c37725
...@@ -35,9 +35,12 @@ int zmq::device (class socket_base_t *insocket_, ...@@ -35,9 +35,12 @@ int zmq::device (class socket_base_t *insocket_,
if (rc != 0) if (rc != 0)
return -1; return -1;
// The algorithm below assumes ratio of request and replies processed // The algorithm below assumes ratio of requests and replies processed
// under full load to be 1:1. // under full load to be 1:1.
// TODO: The current implementation drops messages when
// any of the pipes becomes full.
int more; int more;
size_t moresz; size_t moresz;
zmq_pollitem_t items [] = { zmq_pollitem_t items [] = {
...@@ -56,12 +59,12 @@ int zmq::device (class socket_base_t *insocket_, ...@@ -56,12 +59,12 @@ int zmq::device (class socket_base_t *insocket_,
rc = insocket_->recv (&msg, 0); rc = insocket_->recv (&msg, 0);
if (unlikely (rc < 0)) if (unlikely (rc < 0))
return -1; return -1;
moresz = sizeof (more); moresz = sizeof more;
rc = insocket_->getsockopt (ZMQ_RCVMORE, &more, &moresz); rc = insocket_->getsockopt (ZMQ_RCVMORE, &more, &moresz);
if (unlikely (rc < 0)) if (unlikely (rc < 0))
return -1; return -1;
rc = outsocket_->send (&msg, more? ZMQ_SNDMORE: 0); rc = outsocket_->send (&msg, more? ZMQ_SNDMORE: 0);
if (unlikely (rc < 0)) if (unlikely (rc < 0))
return -1; return -1;
...@@ -75,12 +78,12 @@ int zmq::device (class socket_base_t *insocket_, ...@@ -75,12 +78,12 @@ int zmq::device (class socket_base_t *insocket_,
rc = outsocket_->recv (&msg, 0); rc = outsocket_->recv (&msg, 0);
if (unlikely (rc < 0)) if (unlikely (rc < 0))
return -1; return -1;
moresz = sizeof (more); moresz = sizeof more;
rc = outsocket_->getsockopt (ZMQ_RCVMORE, &more, &moresz); rc = outsocket_->getsockopt (ZMQ_RCVMORE, &more, &moresz);
if (unlikely (rc < 0)) if (unlikely (rc < 0))
return -1; return -1;
rc = insocket_->send (&msg, more? ZMQ_SNDMORE: 0); rc = insocket_->send (&msg, more? ZMQ_SNDMORE: 0);
if (unlikely (rc < 0)) if (unlikely (rc < 0))
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment