Skip to content

Commit

Permalink
Fix 'recv' function 'flags_' argument default value
Browse files Browse the repository at this point in the history
  • Loading branch information
xiphon committed Jun 2, 2019
1 parent 0672e31 commit 19b5222
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
19 changes: 19 additions & 0 deletions tests/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,25 @@ TEST_CASE("socket send recv message_t", "[socket]")
CHECK(rmsg.size() == *res);
}

TEST_CASE("socket send recv message_t by pointer", "[socket]")
{
zmq::context_t context;
zmq::socket_t s(context, zmq::socket_type::pair);
zmq::socket_t s2(context, zmq::socket_type::pair);
s2.bind("inproc://test");
s.connect("inproc://test");

zmq::message_t smsg(size_t{10});
const auto res_send = s2.send(smsg, zmq::send_flags::none);
CHECK(res_send);
CHECK(*res_send == 10);
CHECK(smsg.size() == 0);

zmq::message_t rmsg;
const bool res = s.recv(&rmsg);
CHECK(res);
}

TEST_CASE("socket recv dontwait", "[socket]")
{
zmq::context_t context;
Expand Down
6 changes: 1 addition & 5 deletions zmq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,11 +1212,7 @@ class socket_base
#ifdef ZMQ_CPP11
ZMQ_DEPRECATED("from 4.3.1, use recv taking a reference to message_t and recv_flags")
#endif
bool recv(message_t *msg_, int flags_
#ifndef ZMQ_CPP11
= 0
#endif
)
bool recv(message_t *msg_, int flags_ = 0)
{
int nbytes = zmq_msg_recv(msg_->handle(), _handle, flags_);
if (nbytes >= 0)
Expand Down

0 comments on commit 19b5222

Please sign in to comment.