diff --git a/slsSupportLib/include/sls/ZmqSocket.h b/slsSupportLib/include/sls/ZmqSocket.h index 4c8479441..75fa0fe2b 100644 --- a/slsSupportLib/include/sls/ZmqSocket.h +++ b/slsSupportLib/include/sls/ZmqSocket.h @@ -32,8 +32,9 @@ namespace sls { #define ROIVERBOSITY // high water mark for gui -#define DEFFAULT_LOW_HWM (25) -#define DEFAULT_LOW_HWM_BUFFERSIZE (1024 * 1024) // 1MB +#define DEFFAULT_LOW_ZMQ_HWM (25) +#define DEFAULT_LOW_ZMQ_HWM_BUFFERSIZE (1024 * 1024) // 1MB +#define DEFAULT_ZMQ_BUFFERSIZE (0) // os default /** zmq header structure */ struct zmqHeader { @@ -113,14 +114,14 @@ class ZmqSocket { int GetSendHighWaterMark(); /** Sets high water mark for outbound messages. Default 1000 (zmqlib). Also - * changes send buffer size depending on low hwm. Must rebind. */ + * changes send buffer size depending on hwm. Must rebind. */ void SetSendHighWaterMark(int limit); /** Returns high water mark for inbound messages */ int GetReceiveHighWaterMark(); /** Sets high water mark for inbound messages. Default 1000 (zmqlib). Also - * changes receiver buffer size depending on low hwm. Must reconnect */ + * changes receiver buffer size depending on hwm. Must reconnect */ void SetReceiveHighWaterMark(int limit); /** Gets kernel buffer for outbound messages. Default 0 (os) */ diff --git a/slsSupportLib/src/ZmqSocket.cpp b/slsSupportLib/src/ZmqSocket.cpp index 25b9f6e2e..c4c024179 100644 --- a/slsSupportLib/src/ZmqSocket.cpp +++ b/slsSupportLib/src/ZmqSocket.cpp @@ -106,9 +106,12 @@ void ZmqSocket::SetSendHighWaterMark(int limit) { throw ZmqSocketError("Could not set ZMQ_SNDHWM to " + std::to_string(limit)); } - if (limit < DEFFAULT_LOW_HWM) { - SetSendBuffer(DEFAULT_LOW_HWM_BUFFERSIZE); + + int bufsize = DEFAULT_ZMQ_BUFFERSIZE; + if (limit < DEFFAULT_LOW_ZMQ_HWM) { + bufsize = DEFAULT_LOW_ZMQ_HWM_BUFFERSIZE; } + SetSendBuffer(bufsize); } int ZmqSocket::GetReceiveHighWaterMark() { @@ -132,9 +135,11 @@ void ZmqSocket::SetReceiveHighWaterMark(int limit) { throw ZmqSocketError("Could not set ZMQ_RCVHWM to " + std::to_string(limit)); } - if (limit < DEFFAULT_LOW_HWM) { - SetReceiveBuffer(DEFAULT_LOW_HWM_BUFFERSIZE); + int bufsize = DEFAULT_ZMQ_BUFFERSIZE; + if (limit < DEFFAULT_LOW_ZMQ_HWM) { + bufsize = DEFAULT_LOW_ZMQ_HWM_BUFFERSIZE; } + SetReceiveBuffer(bufsize); } int ZmqSocket::GetSendBuffer() {