mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-29 04:17:57 +01:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user