From fcfad5682ed7a7f5108853d2a7039aedfd9a9ac2 Mon Sep 17 00:00:00 2001 From: Bob Beaty Date: Thu, 9 Dec 2010 21:42:58 +0100 Subject: Added Recovery Interval in Milliseconds For very high-speed message systems, the memory used for recovery can get to be very large. The corrent limitation on that reduction is the ZMQ_RECOVERY_IVL of 1 sec. I added in an additional option ZMQ_RECOVERY_IVL_MSEC, which is the Recovery Interval in milliseconds. If used, this will override the previous one, and allow you to set a sub-second recovery interval. If not set, the default behavior is to use ZMQ_RECOVERY_IVL. Signed-off-by: Bob Beaty --- src/options.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/options.cpp') diff --git a/src/options.cpp b/src/options.cpp index b4ca6b5..ae35059 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -30,6 +30,7 @@ zmq::options_t::options_t () : affinity (0), rate (100), recovery_ivl (10), + recovery_ivl_msec (-1), use_multicast_loop (true), sndbuf (0), rcvbuf (0), @@ -101,6 +102,14 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, recovery_ivl = (uint32_t) *((int64_t*) optval_); return 0; + case ZMQ_RECOVERY_IVL_MSEC: + if (optvallen_ != sizeof (int64_t) || *((int64_t*) optval_) < 0) { + errno = EINVAL; + return -1; + } + recovery_ivl_msec = (int32_t) *((int64_t*) optval_); + return 0; + case ZMQ_MCAST_LOOP: if (optvallen_ != sizeof (int64_t)) { errno = EINVAL; @@ -225,6 +234,15 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) *optvallen_ = sizeof (int64_t); return 0; + case ZMQ_RECOVERY_IVL_MSEC: + if (*optvallen_ < sizeof (int64_t)) { + errno = EINVAL; + return -1; + } + *((int64_t*) optval_) = recovery_ivl_msec; + *optvallen_ = sizeof (int64_t); + return 0; + case ZMQ_MCAST_LOOP: if (*optvallen_ < sizeof (int64_t)) { errno = EINVAL; -- cgit v1.2.3