Problem: tcp_recv/send_buffer should be byte value instead of scale factor

Solution: change option behaviour and adopt documentation
This commit is contained in:
Constantin Rack
2015-11-13 10:44:53 +01:00
parent 5ba328d7f3
commit ec41f6540f
3 changed files with 20 additions and 23 deletions

View File

@@ -28,7 +28,6 @@
*/
#include <string.h>
#include <cmath>
#include "options.hpp"
#include "err.hpp"
@@ -66,8 +65,8 @@ zmq::options_t::options_t () :
tcp_keepalive_cnt (-1),
tcp_keepalive_idle (-1),
tcp_keepalive_intvl (-1),
tcp_recv_buffer_size (3),
tcp_send_buffer_size (3),
tcp_recv_buffer_size (8192),
tcp_send_buffer_size (8192),
mechanism (ZMQ_NULL),
as_server (0),
gss_plaintext (false),
@@ -284,14 +283,16 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
break;
case ZMQ_TCP_RECV_BUFFER:
if (is_int && (value >= 0 && value <= 10) ) {
tcp_recv_buffer_size = static_cast<unsigned int>(std::pow(2.0, value)) * 1024;
if (is_int && (value > 0) ) {
tcp_recv_buffer_size = static_cast<unsigned int>(value);
return 0;
}
break;
case ZMQ_TCP_SEND_BUFFER:
if (is_int && (value >= 0 && value <= 10) ) {
tcp_send_buffer_size = static_cast<unsigned int>(std::pow(2.0, value)) * 1024;
if (is_int && (value > 0) ) {
tcp_send_buffer_size = static_cast<unsigned int>(value);
return 0;
}
break;