summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/socket_base.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index 10f1404..88ba43f 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -158,11 +158,18 @@ int zmq::socket_base_t::setsockopt (int option_, const void *optval_,
return 0;
case ZMQ_MCAST_LOOP:
- if (optvallen_ != sizeof (bool)) {
+ if (optvallen_ != sizeof (int64_t)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if ((int64_t) *((int64_t*) optval_) == 0 ||
+ (int64_t) *((int64_t*) optval_) == 1) {
+ options.use_multicast_loop = (bool) *((int64_t*) optval_);
+ } else {
errno = EINVAL;
return -1;
}
- options.use_multicast_loop = optval_;
return 0;
default: