diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-03-24 15:18:20 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-03-24 15:18:20 +0100 |
commit | bd9d7715ebe864d1aa85700d1b55b4f37568a1a4 (patch) | |
tree | 5644171a4527028772bc170fff4974c68fc79d4e | |
parent | d61f067f5bade1269213735b8628a92621b62c91 (diff) |
ZMQ_RATE and ZMQ_RECOVERY_IVL types cahnged to int
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | doc/zmq_getsockopt.txt | 4 | ||||
-rw-r--r-- | doc/zmq_setsockopt.txt | 4 | ||||
-rw-r--r-- | src/options.cpp | 21 | ||||
-rw-r--r-- | src/options.hpp | 5 | ||||
-rw-r--r-- | src/pgm_socket.cpp | 4 |
5 files changed, 19 insertions, 19 deletions
diff --git a/doc/zmq_getsockopt.txt b/doc/zmq_getsockopt.txt index 8189cf3..88a4071 100644 --- a/doc/zmq_getsockopt.txt +++ b/doc/zmq_getsockopt.txt @@ -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 diff --git a/doc/zmq_setsockopt.txt b/doc/zmq_setsockopt.txt index 0d1de3d..f486305 100644 --- a/doc/zmq_setsockopt.txt +++ b/doc/zmq_setsockopt.txt @@ -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 diff --git a/src/options.cpp b/src/options.cpp index 4c1289a..13332da 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -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: diff --git a/src/options.hpp b/src/options.hpp index 1699c1a..d039554 100644 --- a/src/options.hpp +++ b/src/options.hpp @@ -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; diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp index 10d8f39..d84ecb0 100644 --- a/src/pgm_socket.cpp +++ b/src/pgm_socket.cpp @@ -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_; |