diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/options.cpp | 21 | ||||
-rw-r--r-- | src/options.hpp | 5 | ||||
-rw-r--r-- | src/pgm_socket.cpp | 4 |
3 files changed, 15 insertions, 15 deletions
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_; |