mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 18:40:27 +01:00
Problem: goto jumping backwards
Solution: replace by for loop
This commit is contained in:
parent
62e48f837d
commit
9da0c6d62f
27
src/pipe.cpp
27
src/pipe.cpp
@ -181,20 +181,21 @@ bool zmq::pipe_t::read (msg_t *msg_)
|
||||
if (unlikely (state != active && state != waiting_for_delimiter))
|
||||
return false;
|
||||
|
||||
read_message:
|
||||
if (!inpipe->read (msg_)) {
|
||||
in_active = false;
|
||||
return false;
|
||||
}
|
||||
for (bool payload_read = false; !payload_read;) {
|
||||
if (!inpipe->read (msg_)) {
|
||||
in_active = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this is a credential, save a copy and receive next message.
|
||||
if (unlikely (msg_->is_credential ())) {
|
||||
const unsigned char *data =
|
||||
static_cast<const unsigned char *> (msg_->data ());
|
||||
credential.set (data, msg_->size ());
|
||||
const int rc = msg_->close ();
|
||||
zmq_assert (rc == 0);
|
||||
goto read_message;
|
||||
// If this is a credential, save a copy and receive next message.
|
||||
if (unlikely (msg_->is_credential ())) {
|
||||
const unsigned char *data =
|
||||
static_cast<const unsigned char *> (msg_->data ());
|
||||
credential.set (data, msg_->size ());
|
||||
const int rc = msg_->close ();
|
||||
zmq_assert (rc == 0);
|
||||
} else
|
||||
payload_read = true;
|
||||
}
|
||||
|
||||
// If delimiter was read, start termination process of the pipe.
|
||||
|
Loading…
Reference in New Issue
Block a user