mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 10:33:52 +01:00
ZMQ_RATE and ZMQ_RECOVERY_IVL types cahnged to int
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
parent
d61f067f5b
commit
bd9d7715eb
@ -131,7 +131,7 @@ The 'ZMQ_RATE' option shall retrieve the maximum send or receive data rate for
|
||||
multicast transports using the specified 'socket'.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: int64_t
|
||||
Option value type:: int
|
||||
Option value unit:: kilobits per second
|
||||
Default value:: 100
|
||||
Applicable socket types:: all, when using multicast transports
|
||||
@ -145,7 +145,7 @@ determines the maximum time in milliseconds that a receiver can be absent from a
|
||||
multicast group before unrecoverable data loss will occur.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: int64_t
|
||||
Option value type:: int
|
||||
Option value unit:: milliseconds
|
||||
Default value:: 10000
|
||||
Applicable socket types:: all, when using multicast transports
|
||||
|
@ -133,7 +133,7 @@ The 'ZMQ_RATE' option shall set the maximum send or receive data rate for
|
||||
multicast transports such as linkzmq:zmq_pgm[7] using the specified 'socket'.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: int64_t
|
||||
Option value type:: int
|
||||
Option value unit:: kilobits per second
|
||||
Default value:: 100
|
||||
Applicable socket types:: all, when using multicast transports
|
||||
@ -151,7 +151,7 @@ needed for recovery will be held in memory. For example, a 1 minute recovery
|
||||
interval at a data rate of 1Gbps requires a 7GB in-memory buffer.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: int64_t
|
||||
Option value type:: int
|
||||
Option value unit:: milliseconds
|
||||
Default value:: 10000
|
||||
Applicable socket types:: all, when using multicast transports
|
||||
|
@ -79,19 +79,19 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
||||
return 0;
|
||||
|
||||
case ZMQ_RATE:
|
||||
if (optvallen_ != sizeof (int64_t) || *((int64_t*) optval_) <= 0) {
|
||||
if (optvallen_ != sizeof (int) || *((int*) optval_) <= 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
rate = (uint32_t) *((int64_t*) optval_);
|
||||
rate = *((int*) optval_);
|
||||
return 0;
|
||||
|
||||
case ZMQ_RECOVERY_IVL:
|
||||
if (optvallen_ != sizeof (int64_t) || *((int64_t*) optval_) < 0) {
|
||||
if (optvallen_ != sizeof (int) || *((int*) optval_) < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
recovery_ivl = (uint32_t) *((int64_t*) optval_);
|
||||
recovery_ivl = *((int*) optval_);
|
||||
return 0;
|
||||
|
||||
case ZMQ_SNDBUF:
|
||||
@ -195,23 +195,22 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
||||
*optvallen_ = identity.size ();
|
||||
return 0;
|
||||
|
||||
|
||||
case ZMQ_RATE:
|
||||
if (*optvallen_ < sizeof (int64_t)) {
|
||||
if (*optvallen_ < sizeof (int)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*((int64_t*) optval_) = rate;
|
||||
*optvallen_ = sizeof (int64_t);
|
||||
*((int*) optval_) = rate;
|
||||
*optvallen_ = sizeof (int);
|
||||
return 0;
|
||||
|
||||
case ZMQ_RECOVERY_IVL:
|
||||
if (*optvallen_ < sizeof (int64_t)) {
|
||||
if (*optvallen_ < sizeof (int)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*((int64_t*) optval_) = recovery_ivl;
|
||||
*optvallen_ = sizeof (int64_t);
|
||||
*((int*) optval_) = recovery_ivl;
|
||||
*optvallen_ = sizeof (int);
|
||||
return 0;
|
||||
|
||||
case ZMQ_SNDBUF:
|
||||
|
@ -40,10 +40,10 @@ namespace zmq
|
||||
blob_t identity;
|
||||
|
||||
// Maximum tranfer rate [kb/s]. Default 100kb/s.
|
||||
uint32_t rate;
|
||||
int rate;
|
||||
|
||||
// Reliability time interval [ms]. Default 10 seconds.
|
||||
uint32_t recovery_ivl;
|
||||
int recovery_ivl;
|
||||
|
||||
// SO_SNDBUF and SO_RCVBUF to be passed to underlying transport sockets.
|
||||
int sndbuf;
|
||||
@ -58,6 +58,7 @@ namespace zmq
|
||||
// Minimum interval between attempts to reconnect, in milliseconds.
|
||||
// Default 100ms
|
||||
int reconnect_ivl;
|
||||
|
||||
// Maximum interval between attempts to reconnect, in milliseconds.
|
||||
// Default 0 (unused)
|
||||
int reconnect_ivl_max;
|
||||
|
@ -668,10 +668,10 @@ void zmq::pgm_socket_t::process_upstream ()
|
||||
int zmq::pgm_socket_t::compute_sqns (int tpdu_)
|
||||
{
|
||||
// Convert rate into B/ms.
|
||||
uint64_t rate = ((uint64_t) options.rate) / 8;
|
||||
uint64_t rate = uint64_t (options.rate) / 8;
|
||||
|
||||
// Compute the size of the buffer in bytes.
|
||||
uint64_t size = options.recovery_ivl * rate;
|
||||
uint64_t size = uint64_t (options.recovery_ivl) * rate;
|
||||
|
||||
// Translate the size into number of packets.
|
||||
uint64_t sqns = size / tpdu_;
|
||||
|
Loading…
Reference in New Issue
Block a user