mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
zmq hwm are specified to 2 for gui and restreaming of receiver if all zmq not closed at end of acquiistion
This commit is contained in:
@ -93,6 +93,18 @@ class ZmqSocket {
|
||||
*/
|
||||
ZmqSocket(const uint32_t portnumber, const char *ethip);
|
||||
|
||||
/** Returns high water mark for outbound messages */
|
||||
int GetSendHighWaterMark();
|
||||
|
||||
/** Sets high water mark for outbound messages. Default 1000 (zmqlib) */
|
||||
void SetSendHighWaterMark(int limit);
|
||||
|
||||
/** Returns high water mark for inbound messages */
|
||||
int GetReceiveHighWaterMark();
|
||||
|
||||
/** Sets high water mark for inbound messages. Default 1000 (zmqlib) */
|
||||
void SetReceiveHighWaterMark(int limit);
|
||||
|
||||
/**
|
||||
* Returns Port Number
|
||||
* @returns Port Number
|
||||
|
@ -315,6 +315,8 @@ enum detFuncs {
|
||||
F_SET_RECEIVER_RATE_CORRECT,
|
||||
F_SET_RECEIVER_SCAN,
|
||||
F_RECEIVER_SET_THRESHOLD,
|
||||
F_GET_RECEIVER_STREAMING_HWM,
|
||||
F_SET_RECEIVER_STREAMING_HWM,
|
||||
|
||||
NUM_REC_FUNCTIONS
|
||||
};
|
||||
@ -631,6 +633,9 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SET_RECEIVER_RATE_CORRECT: return "F_SET_RECEIVER_RATE_CORRECT";
|
||||
case F_SET_RECEIVER_SCAN: return "F_SET_RECEIVER_SCAN";
|
||||
case F_RECEIVER_SET_THRESHOLD: return "F_RECEIVER_SET_THRESHOLD";
|
||||
case F_GET_RECEIVER_STREAMING_HWM: return "F_GET_RECEIVER_STREAMING_HWM";
|
||||
case F_SET_RECEIVER_STREAMING_HWM: return "F_SET_RECEIVER_STREAMING_HWM";
|
||||
|
||||
|
||||
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
|
||||
default: return "Unknown Function";
|
||||
|
@ -48,6 +48,8 @@ ZmqSocket::ZmqSocket(const char *const hostname_or_ip,
|
||||
PrintError();
|
||||
throw sls::ZmqSocketError("Could not set ZMQ_LINGER");
|
||||
}
|
||||
LOG(logDEBUG) << "Default receive high water mark:"
|
||||
<< GetReceiveHighWaterMark();
|
||||
}
|
||||
|
||||
ZmqSocket::ZmqSocket(const uint32_t portnumber, const char *ethip)
|
||||
@ -63,6 +65,7 @@ ZmqSocket::ZmqSocket(const uint32_t portnumber, const char *ethip)
|
||||
PrintError();
|
||||
throw sls::ZmqSocketError("Could not create socket");
|
||||
}
|
||||
LOG(logDEBUG) << "Default send high water mark:" << GetSendHighWaterMark();
|
||||
|
||||
// construct address, can be refactored with libfmt
|
||||
std::ostringstream oss;
|
||||
@ -79,6 +82,44 @@ ZmqSocket::ZmqSocket(const uint32_t portnumber, const char *ethip)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
};
|
||||
|
||||
int ZmqSocket::GetSendHighWaterMark() {
|
||||
int value = 0;
|
||||
size_t value_size = sizeof(value);
|
||||
if (zmq_getsockopt(sockfd.socketDescriptor, ZMQ_SNDHWM, &value,
|
||||
&value_size)) {
|
||||
PrintError();
|
||||
throw sls::ZmqSocketError("Could not get ZMQ_SNDHWM");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
void ZmqSocket::SetSendHighWaterMark(int limit) {
|
||||
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_SNDHWM, &limit,
|
||||
sizeof(limit))) {
|
||||
PrintError();
|
||||
throw sls::ZmqSocketError("Could not set ZMQ_SNDHWM");
|
||||
}
|
||||
}
|
||||
|
||||
int ZmqSocket::GetReceiveHighWaterMark() {
|
||||
int value = 0;
|
||||
size_t value_size = sizeof(value);
|
||||
if (zmq_getsockopt(sockfd.socketDescriptor, ZMQ_RCVHWM, &value,
|
||||
&value_size)) {
|
||||
PrintError();
|
||||
throw sls::ZmqSocketError("Could not get ZMQ_SNDHWM");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
void ZmqSocket::SetReceiveHighWaterMark(int limit) {
|
||||
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_RCVHWM, &limit,
|
||||
sizeof(limit))) {
|
||||
PrintError();
|
||||
throw sls::ZmqSocketError("Could not set ZMQ_SNDHWM");
|
||||
}
|
||||
}
|
||||
|
||||
int ZmqSocket::Connect() {
|
||||
if (zmq_connect(sockfd.socketDescriptor, sockfd.serverAddress.c_str())) {
|
||||
PrintError();
|
||||
|
Reference in New Issue
Block a user