Don't pass flags to xrecv method

This commit is contained in:
Martin Hurton 2012-11-09 17:17:43 +01:00
parent 7865f96e97
commit 66dc4d8b54
20 changed files with 28 additions and 46 deletions

View File

@ -54,11 +54,8 @@ int zmq::dealer_t::xsend (msg_t *msg_)
return lb.send (msg_); return lb.send (msg_);
} }
int zmq::dealer_t::xrecv (msg_t *msg_, int flags_) int zmq::dealer_t::xrecv (msg_t *msg_)
{ {
// flags_ is unused
(void)flags_;
return fq.recv (msg_); return fq.recv (msg_);
} }

View File

@ -48,7 +48,7 @@ namespace zmq
// Overloads of functions from socket_base_t. // Overloads of functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_); void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
int xsend (zmq::msg_t *msg_); int xsend (zmq::msg_t *msg_);
int xrecv (zmq::msg_t *msg_, int flags_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
bool xhas_out (); bool xhas_out ();
void xread_activated (zmq::pipe_t *pipe_); void xread_activated (zmq::pipe_t *pipe_);

View File

@ -86,11 +86,8 @@ int zmq::pair_t::xsend (msg_t *msg_)
return 0; return 0;
} }
int zmq::pair_t::xrecv (msg_t *msg_, int flags_) int zmq::pair_t::xrecv (msg_t *msg_)
{ {
// flags_ is unused
(void)flags_;
// Deallocate old content of the message. // Deallocate old content of the message.
int rc = msg_->close (); int rc = msg_->close ();
errno_assert (rc == 0); errno_assert (rc == 0);

View File

@ -44,7 +44,7 @@ namespace zmq
// Overloads of functions from socket_base_t. // Overloads of functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_); void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
int xsend (zmq::msg_t *msg_); int xsend (zmq::msg_t *msg_);
int xrecv (zmq::msg_t *msg_, int flags_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
bool xhas_out (); bool xhas_out ();
void xread_activated (zmq::pipe_t *pipe_); void xread_activated (zmq::pipe_t *pipe_);

View File

@ -32,7 +32,7 @@ zmq::pub_t::~pub_t ()
{ {
} }
int zmq::pub_t::xrecv (class msg_t *, int) int zmq::pub_t::xrecv (class msg_t *)
{ {
// Messages cannot be received from PUB socket. // Messages cannot be received from PUB socket.
errno = ENOTSUP; errno = ENOTSUP;

View File

@ -40,7 +40,7 @@ namespace zmq
~pub_t (); ~pub_t ();
// Implementations of virtual functions from socket_base_t. // Implementations of virtual functions from socket_base_t.
int xrecv (zmq::msg_t *msg_, int flags_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
private: private:

View File

@ -53,11 +53,8 @@ void zmq::pull_t::xterminated (pipe_t *pipe_)
fq.terminated (pipe_); fq.terminated (pipe_);
} }
int zmq::pull_t::xrecv (msg_t *msg_, int flags_) int zmq::pull_t::xrecv (msg_t *msg_)
{ {
// flags_ is unused
(void)flags_;
return fq.recv (msg_); return fq.recv (msg_);
} }

View File

@ -46,7 +46,7 @@ namespace zmq
// Overloads of functions from socket_base_t. // Overloads of functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_); void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
int xrecv (zmq::msg_t *msg_, int flags_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
void xread_activated (zmq::pipe_t *pipe_); void xread_activated (zmq::pipe_t *pipe_);
void xterminated (zmq::pipe_t *pipe_); void xterminated (zmq::pipe_t *pipe_);

View File

@ -57,7 +57,7 @@ int zmq::rep_t::xsend (msg_t *msg_)
return 0; return 0;
} }
int zmq::rep_t::xrecv (msg_t *msg_, int flags_) int zmq::rep_t::xrecv (msg_t *msg_)
{ {
// If we are in middle of sending a reply, we cannot receive next request. // If we are in middle of sending a reply, we cannot receive next request.
if (sending_reply) { if (sending_reply) {
@ -69,7 +69,7 @@ int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
// to the reply pipe. // to the reply pipe.
if (request_begins) { if (request_begins) {
while (true) { while (true) {
int rc = router_t::xrecv (msg_, flags_); int rc = router_t::xrecv (msg_);
if (rc != 0) if (rc != 0)
return rc; return rc;
@ -95,7 +95,7 @@ int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
} }
// Get next message part to return to the user. // Get next message part to return to the user.
int rc = router_t::xrecv (msg_, flags_); int rc = router_t::xrecv (msg_);
if (rc != 0) if (rc != 0)
return rc; return rc;

View File

@ -41,7 +41,7 @@ namespace zmq
// Overloads of functions from socket_base_t. // Overloads of functions from socket_base_t.
int xsend (zmq::msg_t *msg_); int xsend (zmq::msg_t *msg_);
int xrecv (zmq::msg_t *msg_, int flags_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
bool xhas_out (); bool xhas_out ();

View File

@ -75,7 +75,7 @@ int zmq::req_t::xsend (msg_t *msg_)
return 0; return 0;
} }
int zmq::req_t::xrecv (msg_t *msg_, int flags_) int zmq::req_t::xrecv (msg_t *msg_)
{ {
// If request wasn't send, we can't wait for reply. // If request wasn't send, we can't wait for reply.
if (!receiving_reply) { if (!receiving_reply) {
@ -85,14 +85,14 @@ int zmq::req_t::xrecv (msg_t *msg_, int flags_)
// First part of the reply should be the original request ID. // First part of the reply should be the original request ID.
if (message_begins) { if (message_begins) {
int rc = dealer_t::xrecv (msg_, flags_); int rc = dealer_t::xrecv (msg_);
if (rc != 0) if (rc != 0)
return rc; return rc;
// TODO: This should also close the connection with the peer! // TODO: This should also close the connection with the peer!
if (unlikely (!(msg_->flags () & msg_t::more) || msg_->size () != 0)) { if (unlikely (!(msg_->flags () & msg_t::more) || msg_->size () != 0)) {
while (true) { while (true) {
int rc = dealer_t::xrecv (msg_, flags_); int rc = dealer_t::xrecv (msg_);
errno_assert (rc == 0); errno_assert (rc == 0);
if (!(msg_->flags () & msg_t::more)) if (!(msg_->flags () & msg_t::more))
break; break;
@ -106,7 +106,7 @@ int zmq::req_t::xrecv (msg_t *msg_, int flags_)
message_begins = false; message_begins = false;
} }
int rc = dealer_t::xrecv (msg_, flags_); int rc = dealer_t::xrecv (msg_);
if (rc != 0) if (rc != 0)
return rc; return rc;

View File

@ -43,7 +43,7 @@ namespace zmq
// Overloads of functions from socket_base_t. // Overloads of functions from socket_base_t.
int xsend (zmq::msg_t *msg_); int xsend (zmq::msg_t *msg_);
int xrecv (zmq::msg_t *msg_, int flags_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
bool xhas_out (); bool xhas_out ();

View File

@ -224,11 +224,8 @@ int zmq::router_t::xsend (msg_t *msg_)
return 0; return 0;
} }
int zmq::router_t::xrecv (msg_t *msg_, int flags_) int zmq::router_t::xrecv (msg_t *msg_)
{ {
// flags_ is unused
(void)flags_;
if (prefetched) { if (prefetched) {
if (!identity_sent) { if (!identity_sent) {
int rc = msg_->move (prefetched_id); int rc = msg_->move (prefetched_id);

View File

@ -51,7 +51,7 @@ namespace zmq
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_); void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
int xsetsockopt (int option_, const void *optval_, size_t optvallen_); int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
int xsend (msg_t *msg_); int xsend (msg_t *msg_);
int xrecv (msg_t *msg_, int flags_); int xrecv (msg_t *msg_);
bool xhas_in (); bool xhas_in ();
bool xhas_out (); bool xhas_out ();
void xread_activated (zmq::pipe_t *pipe_); void xread_activated (zmq::pipe_t *pipe_);

View File

@ -689,7 +689,7 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
} }
// Get the message. // Get the message.
int rc = xrecv (msg_, flags_); int rc = xrecv (msg_);
if (unlikely (rc != 0 && errno != EAGAIN)) if (unlikely (rc != 0 && errno != EAGAIN))
return -1; return -1;
@ -708,7 +708,7 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
return -1; return -1;
ticks = 0; ticks = 0;
rc = xrecv (msg_, flags_); rc = xrecv (msg_);
if (rc < 0) if (rc < 0)
return rc; return rc;
extract_flags (msg_); extract_flags (msg_);
@ -726,7 +726,7 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
while (true) { while (true) {
if (unlikely (process_commands (block ? timeout : 0, false) != 0)) if (unlikely (process_commands (block ? timeout : 0, false) != 0))
return -1; return -1;
rc = xrecv (msg_, flags_); rc = xrecv (msg_);
if (rc == 0) { if (rc == 0) {
ticks = 0; ticks = 0;
break; break;
@ -897,7 +897,7 @@ bool zmq::socket_base_t::xhas_in ()
return false; return false;
} }
int zmq::socket_base_t::xrecv (msg_t *, int) int zmq::socket_base_t::xrecv (msg_t *)
{ {
errno = ENOTSUP; errno = ENOTSUP;
return -1; return -1;

View File

@ -137,7 +137,7 @@ namespace zmq
// The default implementation assumes that recv in not supported. // The default implementation assumes that recv in not supported.
virtual bool xhas_in (); virtual bool xhas_in ();
virtual int xrecv (zmq::msg_t *msg_, int flags_); virtual int xrecv (zmq::msg_t *msg_);
// i_pipe_events will be forwarded to these functions. // i_pipe_events will be forwarded to these functions.
virtual void xread_activated (pipe_t *pipe_); virtual void xread_activated (pipe_t *pipe_);

View File

@ -145,11 +145,8 @@ bool zmq::xpub_t::xhas_out ()
return dist.has_out (); return dist.has_out ();
} }
int zmq::xpub_t::xrecv (msg_t *msg_, int flags_) int zmq::xpub_t::xrecv (msg_t *msg_)
{ {
// flags_ is unused
(void)flags_;
// If there is at least one // If there is at least one
if (pending.empty ()) { if (pending.empty ()) {
errno = EAGAIN; errno = EAGAIN;

View File

@ -50,7 +50,7 @@ namespace zmq
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_ = false); void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_ = false);
int xsend (zmq::msg_t *msg_); int xsend (zmq::msg_t *msg_);
bool xhas_out (); bool xhas_out ();
int xrecv (zmq::msg_t *msg_, int flags_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
void xread_activated (zmq::pipe_t *pipe_); void xread_activated (zmq::pipe_t *pipe_);
void xwrite_activated (zmq::pipe_t *pipe_); void xwrite_activated (zmq::pipe_t *pipe_);

View File

@ -121,11 +121,8 @@ bool zmq::xsub_t::xhas_out ()
return true; return true;
} }
int zmq::xsub_t::xrecv (msg_t *msg_, int flags_) int zmq::xsub_t::xrecv (msg_t *msg_)
{ {
// flags_ is unused
(void)flags_;
// If there's already a message prepared by a previous call to zmq_poll, // If there's already a message prepared by a previous call to zmq_poll,
// return it straight ahead. // return it straight ahead.
if (has_message) { if (has_message) {

View File

@ -48,7 +48,7 @@ namespace zmq
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_); void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
int xsend (zmq::msg_t *msg_); int xsend (zmq::msg_t *msg_);
bool xhas_out (); bool xhas_out ();
int xrecv (zmq::msg_t *msg_, int flags_); int xrecv (zmq::msg_t *msg_);
bool xhas_in (); bool xhas_in ();
void xread_activated (zmq::pipe_t *pipe_); void xread_activated (zmq::pipe_t *pipe_);
void xwrite_activated (zmq::pipe_t *pipe_); void xwrite_activated (zmq::pipe_t *pipe_);