mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-03 21:06:28 +01:00
Merge pull request #223 from gimaker/libzmq-310
Throw away unexpected data received by XPUB sockets, rather than asserting
This commit is contained in:
commit
0c94cd036a
23
src/xpub.cpp
23
src/xpub.cpp
@ -63,18 +63,19 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
|
||||
// Apply the subscription to the trie.
|
||||
unsigned char *data = (unsigned char*) sub.data ();
|
||||
size_t size = sub.size ();
|
||||
zmq_assert (size > 0 && (*data == 0 || *data == 1));
|
||||
bool unique;
|
||||
if (*data == 0)
|
||||
unique = subscriptions.rm (data + 1, size - 1, pipe_);
|
||||
else
|
||||
unique = subscriptions.add (data + 1, size - 1, pipe_);
|
||||
if (size > 0 && (*data == 0 || *data == 1)) {
|
||||
bool unique;
|
||||
if (*data == 0)
|
||||
unique = subscriptions.rm (data + 1, size - 1, pipe_);
|
||||
else
|
||||
unique = subscriptions.add (data + 1, size - 1, pipe_);
|
||||
|
||||
// If the subscription is not a duplicate store it so that it can be
|
||||
// passed to used on next recv call.
|
||||
if (unique && options.type != ZMQ_PUB)
|
||||
pending.push_back (blob_t ((unsigned char*) sub.data (),
|
||||
sub.size ()));
|
||||
// If the subscription is not a duplicate store it so that it can be
|
||||
// passed to used on next recv call.
|
||||
if (unique && options.type != ZMQ_PUB)
|
||||
pending.push_back (blob_t ((unsigned char*) sub.data (),
|
||||
sub.size ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user