ZMQ_SRCFD docs and tests

Also moved the fd field from message content to message itself
This commit is contained in:
Stefan Radomski
2014-01-07 01:09:51 +01:00
parent 823b7ebeb0
commit 3aeaa6fab1
8 changed files with 129 additions and 20 deletions

View File

@@ -827,12 +827,10 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
if (unlikely (rc != 0 && errno != EAGAIN))
return -1;
// set file descriptor
if (file_desc >= 0)
msg_->set_fd(file_desc);
// If we have the message, return immediately.
if (rc == 0) {
if (file_desc >= 0)
msg_->set_fd(file_desc);
extract_flags (msg_);
return 0;
}
@@ -849,6 +847,8 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
rc = xrecv (msg_);
if (rc < 0)
return rc;
if (file_desc >= 0)
msg_->set_fd(file_desc);
extract_flags (msg_);
return 0;
}
@@ -881,6 +881,8 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
}
}
if (file_desc >= 0)
msg_->set_fd(file_desc);
extract_flags (msg_);
return 0;
}