summaryrefslogtreecommitdiff
path: root/src/options.cpp
diff options
context:
space:
mode:
authorThijs Terlouw <thijsterlouw@gmail.com>2011-01-26 07:01:06 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-01-26 07:01:06 +0100
commitf7f1dfc86dd649edbd789a5d157d74721338c912 (patch)
tree4189c915385050b759eb2a2890adcba25885a476 /src/options.cpp
parent8e61a11b398c95d829f24c388737eb122405c97b (diff)
ZMQ_RECONNECT_IVL_MAX socket option added
It allows for exponential back-off strategy when reconnecting. Signed-off-by: Thijs Terlouw <thijsterlouw@gmail.com>
Diffstat (limited to 'src/options.cpp')
-rw-r--r--src/options.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/options.cpp b/src/options.cpp
index ae35059..c6d5760 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -37,6 +37,7 @@ zmq::options_t::options_t () :
type (-1),
linger (-1),
reconnect_ivl (100),
+ reconnect_ivl_max (0),
backlog (100),
requires_in (false),
requires_out (false),
@@ -161,6 +162,18 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
reconnect_ivl = *((int*) optval_);
return 0;
+ case ZMQ_RECONNECT_IVL_MAX:
+ if (optvallen_ != sizeof (int)) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (*((int*) optval_) < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ reconnect_ivl_max = *((int*) optval_);
+ return 0;
+
case ZMQ_BACKLOG:
if (optvallen_ != sizeof (int)) {
errno = EINVAL;
@@ -297,6 +310,15 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
+ case ZMQ_RECONNECT_IVL_MAX:
+ if (*optvallen_ < sizeof (int)) {
+ errno = EINVAL;
+ return -1;
+ }
+ *((int*) optval_) = reconnect_ivl_max;
+ *optvallen_ = sizeof (int);
+ return 0;
+
case ZMQ_BACKLOG:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;