Commit 36215656 authored by Staffan Gimåker's avatar Staffan Gimåker

Throw away unexpected data received by XPUB sockets, rather than asserting.

Fixes LIBZMQ-310.
Signed-off-by: 's avatarStaffan Gimåker <staffan@spotify.com>
parent 6f32361f
...@@ -63,7 +63,7 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_) ...@@ -63,7 +63,7 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
// Apply the subscription to the trie. // Apply the subscription to the trie.
unsigned char *data = (unsigned char*) sub.data (); unsigned char *data = (unsigned char*) sub.data ();
size_t size = sub.size (); size_t size = sub.size ();
zmq_assert (size > 0 && (*data == 0 || *data == 1)); if (size > 0 && (*data == 0 || *data == 1)) {
bool unique; bool unique;
if (*data == 0) if (*data == 0)
unique = subscriptions.rm (data + 1, size - 1, pipe_); unique = subscriptions.rm (data + 1, size - 1, pipe_);
...@@ -76,6 +76,7 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_) ...@@ -76,6 +76,7 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
pending.push_back (blob_t ((unsigned char*) sub.data (), pending.push_back (blob_t ((unsigned char*) sub.data (),
sub.size ())); sub.size ()));
} }
}
} }
void zmq::xpub_t::xwrite_activated (pipe_t *pipe_) void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
......
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