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:
2020-10-08 13:01:01 +02:00
parent c9bba6fbdc
commit 6c1035aa99
21 changed files with 614 additions and 190 deletions

View File

@ -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();