Commit 26e14d30 authored by Martin Hurton's avatar Martin Hurton

Small code simplification

parent 6f1229be
...@@ -56,15 +56,11 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_) ...@@ -56,15 +56,11 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
{ {
// There are some subscriptions waiting. Let's process them. // There are some subscriptions waiting. Let's process them.
msg_t sub; msg_t sub;
while (true) { while (pipe_->read (&sub)) {
// Grab next subscription.
if (!pipe_->read (&sub))
return;
// Apply the subscription to the trie. // Apply the subscription to the trie.
unsigned char *data = (unsigned char*) sub.data (); unsigned char *const data = (unsigned char*) sub.data ();
size_t size = sub.size (); const size_t size = sub.size ();
if (size > 0 && (*data == 0 || *data == 1)) { if (size > 0 && (*data == 0 || *data == 1)) {
bool unique; bool unique;
if (*data == 0) if (*data == 0)
...@@ -75,11 +71,10 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_) ...@@ -75,11 +71,10 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
// If the subscription is not a duplicate store it so that it can be // If the subscription is not a duplicate store it so that it can be
// passed to used on next recv call. // passed to used on next recv call.
if (unique && options.type != ZMQ_PUB) if (unique && options.type != ZMQ_PUB)
pending.push_back (blob_t ((unsigned char*) sub.data (), pending.push_back (blob_t (data, size));
sub.size ()));
} }
sub.close(); sub.close ();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment