mirror of
https://github.com/zeromq/libzmq.git
synced 2025-05-29 07:25:56 +02:00
Do not pass a message to the check_write method
The check_write method does not use the passed message. The parameter was needed to implement the swap. As the swap is not supported anymore, it is safe to remove this parameter.
This commit is contained in:
parent
ed65271c52
commit
6f47f1281b
12
src/lb.cpp
12
src/lb.cpp
@ -131,17 +131,9 @@ bool zmq::lb_t::has_out ()
|
|||||||
|
|
||||||
while (active > 0) {
|
while (active > 0) {
|
||||||
|
|
||||||
// Check whether zero-sized message can be written to the pipe.
|
// Check whether a pipe has room for another message.
|
||||||
msg_t msg;
|
if (pipes [current]->check_write ())
|
||||||
int rc = msg.init ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
if (pipes [current]->check_write (&msg)) {
|
|
||||||
rc = msg.close ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
rc = msg.close ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
|
|
||||||
// Deactivate the pipe.
|
// Deactivate the pipe.
|
||||||
active--;
|
active--;
|
||||||
|
@ -108,13 +108,7 @@ bool zmq::pair_t::xhas_out ()
|
|||||||
if (!pipe)
|
if (!pipe)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
msg_t msg;
|
return pipe->check_write ();
|
||||||
int rc = msg.init ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
bool result = pipe->check_write (&msg);
|
|
||||||
rc = msg.close ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::pair_session_t::pair_session_t (io_thread_t *io_thread_, bool connect_,
|
zmq::pair_session_t::pair_session_t (io_thread_t *io_thread_, bool connect_,
|
||||||
|
@ -146,7 +146,7 @@ bool zmq::pipe_t::read (msg_t *msg_)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zmq::pipe_t::check_write (msg_t *msg_)
|
bool zmq::pipe_t::check_write ()
|
||||||
{
|
{
|
||||||
if (unlikely (!out_active || state != active))
|
if (unlikely (!out_active || state != active))
|
||||||
return false;
|
return false;
|
||||||
@ -163,7 +163,7 @@ bool zmq::pipe_t::check_write (msg_t *msg_)
|
|||||||
|
|
||||||
bool zmq::pipe_t::write (msg_t *msg_)
|
bool zmq::pipe_t::write (msg_t *msg_)
|
||||||
{
|
{
|
||||||
if (unlikely (!check_write (msg_)))
|
if (unlikely (!check_write ()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool more = msg_->flags () & msg_t::more ? true : false;
|
bool more = msg_->flags () & msg_t::more ? true : false;
|
||||||
|
@ -87,7 +87,7 @@ namespace zmq
|
|||||||
|
|
||||||
// Checks whether messages can be written to the pipe. If writing
|
// Checks whether messages can be written to the pipe. If writing
|
||||||
// the message would cause high watermark the function returns false.
|
// the message would cause high watermark the function returns false.
|
||||||
bool check_write (msg_t *msg_);
|
bool check_write ();
|
||||||
|
|
||||||
// Writes a message to the underlying pipe. Returns false if the
|
// Writes a message to the underlying pipe. Returns false if the
|
||||||
// message cannot be written because high watermark was reached.
|
// message cannot be written because high watermark was reached.
|
||||||
|
@ -152,21 +152,15 @@ int zmq::router_t::xsend (msg_t *msg_, int flags_)
|
|||||||
|
|
||||||
if (it != outpipes.end ()) {
|
if (it != outpipes.end ()) {
|
||||||
current_out = it->second.pipe;
|
current_out = it->second.pipe;
|
||||||
msg_t empty;
|
if (!current_out->check_write ()) {
|
||||||
int rc = empty.init ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
if (!current_out->check_write (&empty)) {
|
|
||||||
it->second.active = false;
|
it->second.active = false;
|
||||||
more_out = false;
|
more_out = false;
|
||||||
current_out = NULL;
|
current_out = NULL;
|
||||||
}
|
}
|
||||||
rc = empty.close ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
} else if(fail_unroutable) {
|
} else if(fail_unroutable) {
|
||||||
more_out = false;
|
more_out = false;
|
||||||
retval = EHOSTUNREACH;
|
retval = EHOSTUNREACH;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int rc = msg_->close ();
|
int rc = msg_->close ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user