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

@ -738,10 +738,9 @@ Applicable socket types:: all, when using TCP transport
ZMQ_TCP_RECV_BUFFER: Size of the TCP receive buffer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECV_BUFFER' specifies the maximum number of bytes which can
be received by an individual syscall to receive data from the TCP
socket. The buffer size is specified as an integer number from 0 (very small)
to 10 (very large). The default value is 3.
The 'ZMQ_TCP_RECV_BUFFER' specifies the maximum number of bytes which can
be received by an individual syscall to receive data from the TCP socket.
The default value is 8192.
[horizontal]
@ -752,10 +751,9 @@ Applicable socket types:: all, when using TCP transport
ZMQ_TCP_SEND_BUFFER: Size of the TCP receive buffer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_SEND_BUFFER' specifies the maximum number of bytes which can
be sent by an individual syscall to transmit data to the TCP
socket. The buffer size is specified as an integer number from 0 (very small)
to 10 (very large). The default value is 3.
The 'ZMQ_TCP_SEND_BUFFER' specifies the maximum number of bytes which can
be sent by an individual syscall to transmit data to the TCP socket.
The default value is 8192.
[horizontal]

View File

@ -1073,10 +1073,9 @@ Applicable socket types:: all, when using TCP transports.
ZMQ_TCP_RECV_BUFFER: Size of the TCP receive buffer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECV_BUFFER' specifies the maximum number of bytes which can
be received by an individual syscall to receive data from the TCP
socket. The buffer size is specified as an integer number from 0 (very small)
to 10 (very large). The default value is 3.
The 'ZMQ_TCP_RECV_BUFFER' specifies the maximum number of bytes which can
be received by an individual syscall to receive data from the TCP socket.
The default value is 8192.
[horizontal]
@ -1087,10 +1086,9 @@ Applicable socket types:: all, when using TCP transport
ZMQ_TCP_SEND_BUFFER: Size of the TCP receive buffer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_SEND_BUFFER' specifies the maximum number of bytes which can
be sent by an individual syscall to transmit data to the TCP
socket. The buffer size is specified as an integer number from 0 (very small)
to 10 (very large). The default value is 3.
The 'ZMQ_TCP_SEND_BUFFER' specifies the maximum number of bytes which can
be sent by an individual syscall to transmit data to the TCP socket.
The default value is 8192.
[horizontal]

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;