summaryrefslogtreecommitdiff
path: root/src/sub.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-07-12 13:05:58 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-07-12 13:05:58 +0200
commit57c1342c683df3207094e8ec660e72812be37f9c (patch)
treee317dd341795de7b48cb876eb41dbf7cf7dfbdb8 /src/sub.cpp
parent29274811ccf2ca905360a463c5124e9e4e4c1708 (diff)
Bug with setting options on SUB socket fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/sub.cpp')
-rw-r--r--src/sub.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sub.cpp b/src/sub.cpp
index 2a1454a..81082a2 100644
--- a/src/sub.cpp
+++ b/src/sub.cpp
@@ -38,6 +38,11 @@ zmq::sub_t::~sub_t ()
int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
size_t optvallen_)
{
+ if (option_ != ZMQ_SUBSCRIBE && option_ != ZMQ_UNSUBSCRIBE) {
+ errno = EINVAL;
+ return -1;
+ }
+
// Create the subscription message.
msg_t msg;
int rc = msg.init_size (optvallen_ + 1);