Commit ec41f654 authored by Constantin Rack's avatar Constantin Rack

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

Solution: change option behaviour and adopt documentation
parent 5ba328d7
...@@ -738,10 +738,9 @@ Applicable socket types:: all, when using TCP transport ...@@ -738,10 +738,9 @@ Applicable socket types:: all, when using TCP transport
ZMQ_TCP_RECV_BUFFER: Size of the TCP receive buffer ZMQ_TCP_RECV_BUFFER: Size of the TCP receive buffer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECV_BUFFER' specifies the maximum number of bytes which can 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 be received by an individual syscall to receive data from the TCP socket.
socket. The buffer size is specified as an integer number from 0 (very small) The default value is 8192.
to 10 (very large). The default value is 3.
[horizontal] [horizontal]
...@@ -752,10 +751,9 @@ Applicable socket types:: all, when using TCP transport ...@@ -752,10 +751,9 @@ Applicable socket types:: all, when using TCP transport
ZMQ_TCP_SEND_BUFFER: Size of the TCP receive buffer ZMQ_TCP_SEND_BUFFER: Size of the TCP receive buffer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_SEND_BUFFER' specifies the maximum number of bytes which can 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 be sent by an individual syscall to transmit data to the TCP socket.
socket. The buffer size is specified as an integer number from 0 (very small) The default value is 8192.
to 10 (very large). The default value is 3.
[horizontal] [horizontal]
......
...@@ -1073,10 +1073,9 @@ Applicable socket types:: all, when using TCP transports. ...@@ -1073,10 +1073,9 @@ Applicable socket types:: all, when using TCP transports.
ZMQ_TCP_RECV_BUFFER: Size of the TCP receive buffer ZMQ_TCP_RECV_BUFFER: Size of the TCP receive buffer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RECV_BUFFER' specifies the maximum number of bytes which can 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 be received by an individual syscall to receive data from the TCP socket.
socket. The buffer size is specified as an integer number from 0 (very small) The default value is 8192.
to 10 (very large). The default value is 3.
[horizontal] [horizontal]
...@@ -1087,10 +1086,9 @@ Applicable socket types:: all, when using TCP transport ...@@ -1087,10 +1086,9 @@ Applicable socket types:: all, when using TCP transport
ZMQ_TCP_SEND_BUFFER: Size of the TCP receive buffer ZMQ_TCP_SEND_BUFFER: Size of the TCP receive buffer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_SEND_BUFFER' specifies the maximum number of bytes which can 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 be sent by an individual syscall to transmit data to the TCP socket.
socket. The buffer size is specified as an integer number from 0 (very small) The default value is 8192.
to 10 (very large). The default value is 3.
[horizontal] [horizontal]
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
*/ */
#include <string.h> #include <string.h>
#include <cmath>
#include "options.hpp" #include "options.hpp"
#include "err.hpp" #include "err.hpp"
...@@ -66,8 +65,8 @@ zmq::options_t::options_t () : ...@@ -66,8 +65,8 @@ zmq::options_t::options_t () :
tcp_keepalive_cnt (-1), tcp_keepalive_cnt (-1),
tcp_keepalive_idle (-1), tcp_keepalive_idle (-1),
tcp_keepalive_intvl (-1), tcp_keepalive_intvl (-1),
tcp_recv_buffer_size (3), tcp_recv_buffer_size (8192),
tcp_send_buffer_size (3), tcp_send_buffer_size (8192),
mechanism (ZMQ_NULL), mechanism (ZMQ_NULL),
as_server (0), as_server (0),
gss_plaintext (false), gss_plaintext (false),
...@@ -284,14 +283,16 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -284,14 +283,16 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
break; break;
case ZMQ_TCP_RECV_BUFFER: case ZMQ_TCP_RECV_BUFFER:
if (is_int && (value >= 0 && value <= 10) ) { if (is_int && (value > 0) ) {
tcp_recv_buffer_size = static_cast<unsigned int>(std::pow(2.0, value)) * 1024; tcp_recv_buffer_size = static_cast<unsigned int>(value);
return 0;
} }
break; break;
case ZMQ_TCP_SEND_BUFFER: case ZMQ_TCP_SEND_BUFFER:
if (is_int && (value >= 0 && value <= 10) ) { if (is_int && (value > 0) ) {
tcp_send_buffer_size = static_cast<unsigned int>(std::pow(2.0, value)) * 1024; tcp_send_buffer_size = static_cast<unsigned int>(value);
return 0;
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment