mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-03 19:30:04 +02:00
zmq: set zmq buffer size also to 0 if hwm >= 25 (#653)
This commit is contained in:
parent
4ee4d66977
commit
8361f2bb96
@ -32,8 +32,9 @@ namespace sls {
|
|||||||
#define ROIVERBOSITY
|
#define ROIVERBOSITY
|
||||||
|
|
||||||
// high water mark for gui
|
// high water mark for gui
|
||||||
#define DEFFAULT_LOW_HWM (25)
|
#define DEFFAULT_LOW_ZMQ_HWM (25)
|
||||||
#define DEFAULT_LOW_HWM_BUFFERSIZE (1024 * 1024) // 1MB
|
#define DEFAULT_LOW_ZMQ_HWM_BUFFERSIZE (1024 * 1024) // 1MB
|
||||||
|
#define DEFAULT_ZMQ_BUFFERSIZE (0) // os default
|
||||||
|
|
||||||
/** zmq header structure */
|
/** zmq header structure */
|
||||||
struct zmqHeader {
|
struct zmqHeader {
|
||||||
@ -113,14 +114,14 @@ class ZmqSocket {
|
|||||||
int GetSendHighWaterMark();
|
int GetSendHighWaterMark();
|
||||||
|
|
||||||
/** Sets high water mark for outbound messages. Default 1000 (zmqlib). Also
|
/** 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);
|
void SetSendHighWaterMark(int limit);
|
||||||
|
|
||||||
/** Returns high water mark for inbound messages */
|
/** Returns high water mark for inbound messages */
|
||||||
int GetReceiveHighWaterMark();
|
int GetReceiveHighWaterMark();
|
||||||
|
|
||||||
/** Sets high water mark for inbound messages. Default 1000 (zmqlib). Also
|
/** 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);
|
void SetReceiveHighWaterMark(int limit);
|
||||||
|
|
||||||
/** Gets kernel buffer for outbound messages. Default 0 (os) */
|
/** Gets kernel buffer for outbound messages. Default 0 (os) */
|
||||||
|
@ -106,9 +106,12 @@ void ZmqSocket::SetSendHighWaterMark(int limit) {
|
|||||||
throw ZmqSocketError("Could not set ZMQ_SNDHWM to " +
|
throw ZmqSocketError("Could not set ZMQ_SNDHWM to " +
|
||||||
std::to_string(limit));
|
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() {
|
int ZmqSocket::GetReceiveHighWaterMark() {
|
||||||
@ -132,9 +135,11 @@ void ZmqSocket::SetReceiveHighWaterMark(int limit) {
|
|||||||
throw ZmqSocketError("Could not set ZMQ_RCVHWM to " +
|
throw ZmqSocketError("Could not set ZMQ_RCVHWM to " +
|
||||||
std::to_string(limit));
|
std::to_string(limit));
|
||||||
}
|
}
|
||||||
if (limit < DEFFAULT_LOW_HWM) {
|
int bufsize = DEFAULT_ZMQ_BUFFERSIZE;
|
||||||
SetReceiveBuffer(DEFAULT_LOW_HWM_BUFFERSIZE);
|
if (limit < DEFFAULT_LOW_ZMQ_HWM) {
|
||||||
|
bufsize = DEFAULT_LOW_ZMQ_HWM_BUFFERSIZE;
|
||||||
}
|
}
|
||||||
|
SetReceiveBuffer(bufsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZmqSocket::GetSendBuffer() {
|
int ZmqSocket::GetSendBuffer() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user