mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 03:20:13 +01:00
ZMQ_MULTICAST_HOPS socket option added
Sets the time-to-live field in every multicast packet sent from the socket. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
@@ -29,6 +29,7 @@ zmq::options_t::options_t () :
|
||||
affinity (0),
|
||||
rate (100),
|
||||
recovery_ivl (10000),
|
||||
multicast_hops (1),
|
||||
sndbuf (0),
|
||||
rcvbuf (0),
|
||||
type (-1),
|
||||
@@ -165,6 +166,14 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
||||
maxmsgsize = *((int64_t*) optval_);
|
||||
return 0;
|
||||
|
||||
case ZMQ_MULTICAST_HOPS:
|
||||
if (optvallen_ != sizeof (int) || *((int*) optval_) <= 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
multicast_hops = *((int*) optval_);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
errno = EINVAL;
|
||||
@@ -301,6 +310,15 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
||||
*optvallen_ = sizeof (int64_t);
|
||||
return 0;
|
||||
|
||||
case ZMQ_MULTICAST_HOPS:
|
||||
if (*optvallen_ < sizeof (int)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*((int*) optval_) = multicast_hops;
|
||||
*optvallen_ = sizeof (int);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
errno = EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user