Skip to content

Commit

Permalink
Problem: no permission to relicense ZMQ_RECONNECT_IVL_MAX
Browse files Browse the repository at this point in the history
Solution: remove the implementation. Thijs Terlouw <thijsterlouw@gmail.com>,
the author, did not respond to requests to allow relicensing to MPL2,
so we have to remove his copyrighted work.
Remove the implementation and make get/set return -EOPNOTSUPP.
  • Loading branch information
bluca committed Jun 4, 2023
1 parent fea64d0 commit faa9b62
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 62 deletions.
26 changes: 7 additions & 19 deletions doc/zmq_getsockopt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -619,23 +619,11 @@ Default value:: 100
Applicable socket types:: all, only for connection-oriented transports


ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECONNECT_IVL_MAX' option shall retrieve the maximum reconnection
interval for the specified 'socket'. This is the maximum period 0MQ shall wait
between attempts to reconnect. On each reconnect attempt, the previous interval
shall be doubled until ZMQ_RECONNECT_IVL_MAX is reached. This allows for
exponential backoff strategy. Default value means no exponential backoff is
performed and reconnect interval calculations are only based on
ZMQ_RECONNECT_IVL.

NOTE: Values less than ZMQ_RECONNECT_IVL will be ignored.

[horizontal]
Option value type:: int
Option value unit:: milliseconds
Default value:: 0 (only use ZMQ_RECONNECT_IVL)
Applicable socket types:: all, only for connection-oriented transport
ZMQ_RECONNECT_IVL_MAX: DEPRECATED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECONNECT_IVL_MAX option is an empty stub that only returns an
*EOPNOTSUPP* error, as the author did not provide a relicense agreement for
the Mozilla Public License v2 relicense of libzmq.


ZMQ_RECONNECT_STOP: Retrieve condition where reconnection will stop
Expand Down Expand Up @@ -985,8 +973,8 @@ Applicable socket types:: All, when using TCP, IPC, PGM or NORM transport.

ZMQ_TOPICS_COUNT: Number of topic subscriptions received
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gets the number of topic (prefix) subscriptions either
* received on a (X)PUB socket from all the connected (X)SUB sockets or
Gets the number of topic (prefix) subscriptions either
* received on a (X)PUB socket from all the connected (X)SUB sockets or
* acknowledged on an (X)SUB socket from all the connected (X)PUB sockets

NOTE: in DRAFT state, not yet available in stable releases.
Expand Down
23 changes: 6 additions & 17 deletions doc/zmq_setsockopt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -750,22 +750,11 @@ Default value:: 100
Applicable socket types:: all, only for connection-oriented transports


ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECONNECT_IVL_MAX' option shall set the maximum reconnection interval
for the specified 'socket'. This is the maximum period 0MQ shall wait between
attempts to reconnect. On each reconnect attempt, the previous interval shall be
doubled until ZMQ_RECONNECT_IVL_MAX is reached. This allows for exponential
backoff strategy. Default value means no exponential backoff is performed and
reconnect interval calculations are only based on ZMQ_RECONNECT_IVL.

NOTE: Values less than ZMQ_RECONNECT_IVL will be ignored.

[horizontal]
Option value type:: int
Option value unit:: milliseconds
Default value:: 0 (only use ZMQ_RECONNECT_IVL)
Applicable socket types:: all, only for connection-oriented transports
ZMQ_RECONNECT_IVL_MAX: DEPRECATED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECONNECT_IVL_MAX option is an empty stub that only returns an
*EOPNOTSUPP* error, as the author did not provide a relicense agreement for
the Mozilla Public License v2 relicense of libzmq.


ZMQ_RECONNECT_STOP: Set condition where reconnection will stop
Expand All @@ -784,7 +773,7 @@ connection attempts to non-0MQ sockets. Note that when specifying this option
you may also want to set `ZMQ_HANDSHAKE_IVL` -- the default handshake interval
is 30000 (30 seconds), which is typically too large.

The 'ZMQ_RECONNECT_STOP_AFTER_DISCONNECT' option will stop reconnection when
The 'ZMQ_RECONNECT_STOP_AFTER_DISCONNECT' option will stop reconnection when
zmq_disconnect() has been called. This can be useful when the user's request failed
(server not ready), as the socket does not need to continue to reconnect after
user disconnect actively.
Expand Down
13 changes: 2 additions & 11 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ zmq::options_t::options_t () :
tcp_maxrt (0),
reconnect_stop (0),
reconnect_ivl (100),
reconnect_ivl_max (0),
backlog (100),
maxmsgsize (-1),
rcvtimeo (-1),
Expand Down Expand Up @@ -428,11 +427,7 @@ int zmq::options_t::setsockopt (int option_,
break;

case ZMQ_RECONNECT_IVL_MAX:
if (is_int && value >= 0) {
reconnect_ivl_max = value;
return 0;
}
break;
return -EOPNOTSUPP;

case ZMQ_BACKLOG:
if (is_int && value >= 0) {
Expand Down Expand Up @@ -1076,11 +1071,7 @@ int zmq::options_t::getsockopt (int option_,
break;

case ZMQ_RECONNECT_IVL_MAX:
if (is_int) {
*value = reconnect_ivl_max;
return 0;
}
break;
return -EOPNOTSUPP;

case ZMQ_BACKLOG:
if (is_int) {
Expand Down
4 changes: 0 additions & 4 deletions src/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ struct options_t
// Default 100ms
int reconnect_ivl;

// Maximum interval between attempts to reconnect, in milliseconds.
// Default 0 (unused)
int reconnect_ivl_max;

// Maximum backlog for pending connections.
int backlog;

Expand Down
11 changes: 0 additions & 11 deletions src/stream_connecter_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,6 @@ int zmq::stream_connecter_base_t::get_new_reconnect_ivl ()
? _current_reconnect_ivl + random_jitter
: std::numeric_limits<int>::max ();

// Only change the new current reconnect interval if the maximum reconnect
// interval was set and if it's larger than the reconnect interval.
if (options.reconnect_ivl_max > 0
&& options.reconnect_ivl_max > options.reconnect_ivl) {
// Calculate the next interval
_current_reconnect_ivl =
_current_reconnect_ivl < std::numeric_limits<int>::max () / 2
? std::min (_current_reconnect_ivl * 2, options.reconnect_ivl_max)
: options.reconnect_ivl_max;
}

return interval;
}

Expand Down

0 comments on commit faa9b62

Please sign in to comment.