mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Problem: maximum allowed value for ZMQ_HEARTBEAT_TTL is wrong
Solution: use UINT16_MAX
This commit is contained in:
parent
50374bf6f5
commit
d90e70c1cf
@ -361,6 +361,7 @@ no effect.
|
||||
Option value type:: int
|
||||
Option value unit:: milliseconds
|
||||
Default value:: 0
|
||||
Maximum value:: 6553599 (which is 2^16-1 deciseconds)
|
||||
Applicable socket types:: all, when using connection-oriented transports
|
||||
|
||||
|
||||
|
@ -282,6 +282,8 @@ int zmq::options_t::set_curve_key (uint8_t *destination,
|
||||
return -1;
|
||||
}
|
||||
|
||||
const int deciseconds_per_millisecond = 100;
|
||||
|
||||
int zmq::options_t::setsockopt (int option_,
|
||||
const void *optval_,
|
||||
size_t optvallen_)
|
||||
@ -665,8 +667,8 @@ int zmq::options_t::setsockopt (int option_,
|
||||
|
||||
case ZMQ_HEARTBEAT_TTL:
|
||||
// Convert this to deciseconds from milliseconds
|
||||
value = value / 100;
|
||||
if (is_int && value >= 0 && value <= 6553) {
|
||||
value = value / deciseconds_per_millisecond;
|
||||
if (is_int && value >= 0 && value <= UINT16_MAX) {
|
||||
heartbeat_ttl = static_cast<uint16_t> (value);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user