0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-31 01:43:02 +08:00

Whitespace and comment fixes

This commit is contained in:
Pieter Hintjens 2013-01-08 09:16:50 +01:00
parent da0efaa817
commit a4bedc5255
2 changed files with 19 additions and 18 deletions

View File

@ -74,9 +74,9 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
if (options.type == ZMQ_XPUB && (unique || (*data && verbose)))
pending.push_back (blob_t (data, size));
}
else /*process message unrelated to sub/unsub*/ {
else
// Process user message coming upstream from xsub socket
pending.push_back (blob_t (data, size));
}
sub.close ();
}
@ -177,13 +177,12 @@ void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
xpub_t *self = (xpub_t*) arg_;
if (self->options.type != ZMQ_PUB) {
// Place the unsubscription to the queue of pending (un)sunscriptions
// to be retrived by the user later on.
blob_t unsub (size_ + 1, 0);
unsub [0] = 0;
memcpy (&unsub [1], data_, size_);
self->pending.push_back (unsub);
// Place the unsubscription to the queue of pending (un)sunscriptions
// to be retrived by the user later on.
blob_t unsub (size_ + 1, 0);
unsub [0] = 0;
memcpy (&unsub [1], data_, size_);
self->pending.push_back (unsub);
}
}

View File

@ -48,7 +48,7 @@ zmq::xsub_t::~xsub_t ()
void zmq::xsub_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
{
// icanhasall_ is unused
(void)icanhasall_;
(void) icanhasall_;
zmq_assert (pipe_);
fq.attach (pipe_);
@ -87,22 +87,24 @@ int zmq::xsub_t::xsend (msg_t *msg_)
size_t size = msg_->size ();
unsigned char *data = (unsigned char*) msg_->data ();
// Process the subscription.
if (*data == 1) {
// this used to filter out duplicate subscriptions,
// however this is alread done on the XPUB side and
// doing it here as well breaks ZMQ_XPUB_VERBOSE
// when there are forwarding devices involved
// Process subscribe message
// This used to filter out duplicate subscriptions,
// however this is alread done on the XPUB side and
// doing it here as well breaks ZMQ_XPUB_VERBOSE
// when there are forwarding devices involved.
subscriptions.add (data + 1, size - 1);
return dist.send_to_all (msg_);
}
else if (*data == 0) {
else
if (*data == 0) {
// Process unsubscribe message
if (subscriptions.rm (data + 1, size - 1))
return dist.send_to_all (msg_);
}
else /*upstream message unrelated to sub/unsub*/ {
else
// User message sent upstream to XPUB socket
return dist.send_to_all (msg_);
}
int rc = msg_->close ();
errno_assert (rc == 0);